Skip to content

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

Closed
dstansby wants to merge 4 commits into
matplotlib:masterfrom
dstansby:twin-ticker-copy
Closed

Added share_tickers parameter to axes._AxesBase.twinx/y#10960
dstansby wants to merge 4 commits into
matplotlib:masterfrom
dstansby:twin-ticker-copy

Conversation

@dstansby

@dstansby dstansby commented Apr 5, 2018

Copy link
Copy Markdown
Member

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

jklymak commented Apr 5, 2018

Copy link
Copy Markdown
Member

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

efiring commented Apr 5, 2018

Copy link
Copy Markdown
Member

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

jklymak commented Apr 5, 2018

Copy link
Copy Markdown
Member

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

dstansby commented Apr 5, 2018

Copy link
Copy Markdown
Member Author

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

dstansby commented Apr 5, 2018

Copy link
Copy Markdown
Member Author

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

@dstansby

dstansby commented Apr 5, 2018

Copy link
Copy Markdown
Member Author

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

jklymak commented Apr 5, 2018

Copy link
Copy Markdown
Member

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

@efiring efiring left a comment

Copy link
Copy Markdown
Member

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

dstansby commented Apr 6, 2018

Copy link
Copy Markdown
Member Author

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