Jack Smith
Jack Smith

Reputation: 423

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?

Upvotes: 4

Views: 9173

Answers (1)

askewchan
askewchan

Reputation: 46530

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)

Upvotes: 10

Related Questions