Skip to content

Added share_tickers parameter to axes._AxesBase.twinx/y #10960

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
wants to merge 4 commits into from

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Apr 5, 2018

This is my attempt to resurrect #7528, which fixes #7376.

@dstansby dstansby added this to the v3.0 milestone Apr 5, 2018
@dstansby dstansby changed the title ENH: Added share_tickers parameter to axes._AxesBase.twinx/y Added share_tickers parameter to axes._AxesBase.twinx/y Apr 5, 2018
@jklymak
Copy link
Member

jklymak commented Apr 5, 2018

Can you provide an example as well? I finally parsed why we would want this from the original issue, and I think it’d be a helpful example to have.

I guess I’m also still concerned that @efiring issue with the locator being different is still valid because the locator also returns the autolims. Which locator wins if the locators are different? This should be consistent and documented.

@efiring
Copy link
Member

efiring commented Apr 5, 2018

Given the warning of possible dire consequences, why do this at all? I think this is simply a bad idea, short of a total overhaul of the way we track and determine axis limits.

@jklymak
Copy link
Member

jklymak commented Apr 5, 2018

I think it’s a useful idea to have a second scale for the same axis, which i think was the original idea. But I’m not at all sure this is the best way to do it.

@dstansby
Copy link
Member Author

dstansby commented Apr 5, 2018

My personal example, is I have a timeseries data, on two shared x-axis. I want to put timestamps on one of the axis labels, but want to format the second axis labels a different way (but still have them linked, so when I drag or zoom one the other drags/zooms too).

I don't think this is a bad idea at all in theory - the location of data on the graph is independent of the ticks and labels above. I'll have a proper look at the autoscaling worries soon.

@dstansby
Copy link
Member Author

dstansby commented Apr 5, 2018

(at least as a minimum being able to set different formatters would be good if setting different locators is a problem.)

@dstansby
Copy link
Member Author

dstansby commented Apr 5, 2018

To record my findings, the way I think autoscale_view works is:

  1. Call autoscale_view on a single axis (I don't think it's possible to call it on a shared set)
  2. Work out the data limits from all the current axis and all of its shared axis'
  3. Using these data limts, let the locator of the current axis determine the final view limits

So I don't think having different locators is a problem code wise - there might just be different results depending on which axis is autoscaled, even if they are twinned. Would that be a problem?

@jklymak
Copy link
Member

jklymak commented Apr 5, 2018

This and #10961 are almost the same thing....

Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with #1061, I don't think this is a good approach. I will try to come up with an alternative this weekend.

@dstansby
Copy link
Member Author

dstansby commented Apr 6, 2018

Okay, I'll close this in favour of discussion on #10976, thanks for taking the time to look over this!

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

Successfully merging this pull request may close these issues.

Twinned axes do not allow setting of different formatters
4 participants