Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

two y axis with same scale

I did a histogram with two y-axis and two datasets but I can't set the scales of the two y-axis to the same limits.

In this example http://matplotlib.org/examples/api/two_scales.html#api-two-scales the idea would be to have both scales from 0 to 25.000.

Does anybody have an idea for this case?

like image 995
Jack Smith Avatar asked Oct 18 '25 19:10

Jack Smith


1 Answers

Have you tried something like:

...

# twinx to duplicate y axis
ax2 = ax1.twinx()

# set the same limits for both axis
a,b = 0,25000
ax1.set_ylim(a,b)
ax2.set_ylim(a,b)
like image 179
askewchan Avatar answered Oct 21 '25 12:10

askewchan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!