-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Tick label padding on first y-axis changes when adding a second y-axis #4346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you reverse the order fig = plt.figure()
ax1 = plt.subplot()
ax1.plot(range(2), range(2))
ax1.set_ylabel('y label')
ax2 = ax1.twinx()
ax1.yaxis.set_tick_params(which='major', labelsize=12, direction='out') It works correctly. @stretch97 You seem to have a talent for finding really odd subtle bugs. |
Talent?! I think of it as a curse. =) Anyways, thanks for the temporary work around. |
I think this is only working with out Autoscaling the limits (with the margins) is one of the big style changes for 2.0 so that functionality needs to remain. It also looks like the last image you posted still shows the extra space between the tick labels and the ticks on the left axes. |
I'm closing this because the original problem above seems to be gone now. Reopen if I have misunderstood. With fig = plt.figure()
ax1 = plt.subplot()
ax1.plot(range(2),range(2))
ax1.yaxis.set_tick_params(which = 'major', direction = 'out', \
labelsize = mpl.rcParams['font.size'], size = mpl.rcParams['ytick.major.size'])
ax2 = ax1.twinx()
fig.savefig('Issue.png') |
Yes, the problem does appear to be gone. Thank you to whomever inadvertently solved it! |
When I have just the right set of commands, the tick label padding on the first y-axis changes when I add a second y-axis. Here are my minimal working examples.
This set of commands
produces a figure that looks fine to me:

This set of commands,
also produces a figure that looks fine, even after adding a second y-axis:
This set of commands
however, messes with the tick label padding on the first y-axis:
Apparently, the following commands
do not play nice together.
In case it matters, I am on matplotlib 1.4.0
The text was updated successfully, but these errors were encountered: