Incorrect ylabel placement in twinx #1608

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

4 participants

@goyodiaz

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
Matplotlib Developers member

I can not reproduce this with the master branch.

@goyodiaz

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

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

@goyodiaz

Thanks, dopplershift. Your PR indeed did the trick.

@goyodiaz

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

@goyodiaz goyodiaz closed this Jan 17, 2013
@dmcdougall
Matplotlib Developers 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