What is the most pythonic way to plot multiple lineswith very different scales in the same graph with matplotlib? I know can create subplots, but I am not really sure they will give me the best visualization. I don't really care about coloring, legends or any other intricacies at this point.
Asked
Active
Viewed 5,186 times
1 Answers
3
If you only need two scales then you can simple use twinx
and/or twiny
fig, ax = plt.subplots(1, 1)
x = np.arange(11)
ax.plot(x, 'r')
ax2 = ax.twinx()
ax2.plot(x ** 2, 'g')
plt.draw()
I you need more than two see matplotlib: adding second axes() with transparent background? or look into parasitic axes.
-
Hi, this is what i am looking for but it is not working with the mpld3.plot() when I try to render the graph on browser. The zoom feature disable and allow only the 1 axis to zoom in-out. – Jeenit khatri Mar 01 '17 at 12:08