Skip to content
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

shared axes switch to log scale #4450

Closed
anntzer opened this issue May 21, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@anntzer
Copy link
Contributor

commented May 21, 2015

Consider

fig, axs = plt.subplots(2, 2, sharex=True, sharey=True)
for i in range(2):
    for j in range(2):
        axs[i, j].hist(np.arange(10) + 10 ** (i + j)) # widely varying scales
for ax in axs.flat:
    ax.set_xscale("log")

plt.show()

The axes end up x-relim'd to the data limits of the last axes, hiding away the other histograms (that part seems vaguely related to #3481?).

Of course, one may think "just call set_xscale("log") on one of the axes and the others will follow, right?". But switching to a single call axs[0, 0].set_xscale("log") end up as an even worse disaster; the scaling is not changed on the other axes but the tick markers are.

@tacaswell tacaswell added this to the next point release milestone May 21, 2015

@tacaswell tacaswell modified the milestones: proposed next point release, next point release Jul 16, 2015

@tacaswell

This comment has been minimized.

Copy link
Member

commented Jul 16, 2015

There are two indepnedent problems here

  1. the scale does not properly propagate. This one is a bit upsetting, I suspect what is happening is that the Axis locator and formatter is getting updated (as they are the same objects) but the transforms on the axes are not as the Axis objects are not shared. I have a clean way to fix this (PR coming)
  2. the auto limit on shared axes only looks at the last axes (it probably does look at all of them, just independently and sense the shared axis means the Axis object backing each of them is the same object the limits on the last axes it looks at wins. As this works correctly with linear scales I suspect that the special case code for dealing with logs is broken (like much of the autoscaling with log). This is annoying, but can be fixed by manually setting the limits.

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Jul 16, 2015

FIX: update scale on shared axes
Fixes matplotlib#4450

Or at least the scary part of the scale change not propagating
to all shared axes.

@tacaswell tacaswell self-assigned this Jul 16, 2015

@tacaswell tacaswell removed the Needs review label Jul 16, 2015

@tacaswell tacaswell reopened this Jul 17, 2015

@tacaswell

This comment has been minimized.

Copy link
Member

commented Jul 17, 2015

Re opening this as #4709 only fixed one of two problems reported.

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 3, 2017

@afvincent

This comment has been minimized.

Copy link
Contributor

commented Nov 1, 2017

@tacaswell @anntzer Is this issue still active?

2edf1e3 seems to be the switching point between between some wrong behavior and something that looks OK to me:

@anntzer

This comment has been minimized.

Copy link
Contributor Author

commented Nov 1, 2017

Indeed, the issue is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.