Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect ylabel placement in twinx #1608

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

Closed
goyodiaz opened this issue Dec 18, 2012 · 6 comments
Closed

Incorrect ylabel placement in twinx #1608

goyodiaz opened this issue Dec 18, 2012 · 6 comments

Comments

@goyodiaz
Copy link

The ylabel of the new axes is not vertically centered and sometimes it overlaps yticklabels. This happens in recent development versions but not in 1.2.0.

This script shows the issue:

#!/usr/bin/env python

import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt
import numpy as np

x = np.arange(100)
y1 = x
y2 = 1. / (x + 1)

plt.plot(x, y1)
plt.ylabel('Y axis #1')
plt.twinx()
plt.plot(x, y2)
plt.ylabel('Y axis #2')
plt.savefig('test.png')
plt.close()

This is the ouput with mpl 1.2.0 (correct):
test_1 2 0

And with 1.3.x (incorrect):
test_1 3 x

@tacaswell
Copy link
Member

I can not reproduce this with the master branch.

@goyodiaz
Copy link
Author

goyodiaz commented Jan 9, 2013

Thanks, tacaswell. That's weird. I'm using daily builds from https://launchpad.net/~takluyver/+archive/matplotlib-daily (which seems in sync with master), ubuntu 12.10 quantal and python 2.7. I'll ask in the mailing list.

@dopplershift
Copy link
Contributor

Looks related to #1571 . You might see if the PR in #1589 fixes it.

@goyodiaz
Copy link
Author

Thanks, dopplershift. Your PR indeed did the trick.

@goyodiaz
Copy link
Author

This seems to be fixed in master, presumably thanks to commit 8ea6241.

@dmcdougall
Copy link
Member

@goyodiaz Thanks for following up. Glad everything is now working for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants