Skip to content

Incorrect ylabel placement in twinx #1608

Closed

Description

@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

Activity

  1. tacaswell commented on Jan 4, 2013

    @tacaswell
    Member

    I can not reproduce this with the master branch.

  2. goyodiaz commented on Jan 9, 2013

    @goyodiaz
    Author

    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.

  3. dopplershift commented on Jan 9, 2013

    @dopplershift
    Contributor

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

  4. goyodiaz commented on Jan 10, 2013

    @goyodiaz
    Author

    Thanks, dopplershift. Your PR indeed did the trick.

  5. goyodiaz commented on Jan 17, 2013

    @goyodiaz
    Author

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

  6. dmcdougall commented on Jan 17, 2013

    @dmcdougall
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions