4

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?

1
  • 1
    Did you try ax2.set_ylim(0,25000)? Commented Mar 20, 2013 at 21:21

1 Answer 1

10

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) 
Sign up to request clarification or add additional context in comments.

2 Comments

ax2.set_ylim(ax1.set_ylim)) aligns ax2 y-scale on ax1. Useful in many cases (i.e. when ax2 scale is already correct).
you probably thought ax2.set_ylim(ax1.get_ylim())

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.