Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Propagate Axes class and kwargs for twinx and twiny#29325
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Propagate Axes class and kwargs for twinx and twiny#29325
Uh oh!
There was an error while loading.Please reload this page.
Conversation
687849d
tob1d6a54
CompareI'm somewhat hesitant to do this. While it looks feasible at first glance, I've some reservations:
|
cmp0xff commentedDec 17, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi@timhoffm , thank you for the comments. Twinning is powerful for time serieses with different units
When plotting time series data, it happens that several serieses with different units are to be shown in a single figure, with which users would like to interact. One can use the time labels as the shared x axis to twin two overlapping subplots, each has its own y axis with its own unit. This enables simultaneous interaction on the subplots; paning and zooming in one subplot act in the same way on the shared axes of both subplots. Subclassing |
rcomer commentedDec 17, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@cmp0xff could you give an example of a use-case where you need both a subclass and a twinned axes? I appreciate the value of subclasses and I have added functionality to Matplotlib to handle them (#22608). For that PR I had a specific subclass in mind (the Cartopy GeoAxes) as shown in the PR summary. Do you have a specific subclass in mind for this? |
b1d6a54
to2feddad
CompareHi@rcomer , thank you for your hints. After some research, I have realised that what I described above has mostly been implemented byparasite_axes in the In practise, we have an in-house extension of Now that in |
Thanks, this sounds like a reasonable application. I'm fundamentally ok with extending/modifying the behavior of Design considerations:
|
2feddad
toa9c8ca4
Comparea9c8ca4
tob337f94
Compareb337f94
toa228f5d
CompareHi@timhoffm ,
After some thinking, I would go for keeping the current behaviour, defaulting to The reason is that some subclasses use |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
de198d2
toecb384e
Compare-https://github.com/matplotlib/matplotlib/pull/29325/files#r1894693106-https://github.com/matplotlib/matplotlib/pull/29325/files#r1894693188-https://github.com/matplotlib/matplotlib/pull/29325/files#r1894696478Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
3b117c0
to18589f3
CompareHi, it has been two weeks since the last update. May I ask for a second approval / a critical review? Thanks and happy new year. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks@cmp0xff, I just have some comments on the docstrings.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
…lib#29325 (comment)Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
df825b1
to883f049
Compare-matplotlib#29325 (comment)-matplotlib#29325 (comment)-matplotlib#29325 (comment)Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
883f049
tobb8e374
Compare8d3c4db
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
PR summary
Why is this change necessary?
Users may wish to inherit
matplotlib.axes.Axes
, see e.g.https://stackoverflow.com/q/48593124.twinx
/twiny
in the subclass should return subclass instances, instead ofAxes
.kwargs
,twinx
/twiny
should also be able to accept these extra arguments.What problem does it solve?
The proposed changes fix the behaviour of the methods mentioned above..
What is the reasoning for this implementation?
We try to keep the changes to a minimum and maintain current behaviours.
PR checklist