You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The feature request describes a more flexible approach to sharing axis labels. I haven't found a clean way to use the mpl /uplt syntax to easily share labels in a "complex" plot, i.e. a plot in which not all axis are shared but some.
In this way we could capitalize on the existing format function but extend its functionality to share formatting only on certain properties and not all.
False or 0: Axis sharing is disabled.
'labels', 'labs', or 1: Axis labels are shared, but nothing else. Labels will appear on the leftmost and bottommost subplots.
'limits', 'lims', or 2: Same as 1, but axis limits, axis scales, and major and minor tick locations and formatting are also shared.
True or 3 (default): Same as 2, but axis tick labels are also shared. Tick labels will appear on the leftmost and bottommost subplots.
'all' or 4: Same as 3, but axis limits, axis scales, and axis ticks are shared even between subplots not in the same row or column.
I want this feature to be available on a subset of axes not all or nothing.
Great idea. More granular subgraph labeling.
By the way, I just tested the same code in Proplot (off course using old matplotlib == 3.4.3 and numpy == 1.23.0)
It shows rightly comprared to the newest version of Ultraplot.
Apparently, I can explicitly set them by "ylim" by way of compromise.
Is it related to matplotlib's code changes?
I mean when I set fig_sd = pplt.figure(sharey='all') or fig_sd = pplt.figure(sharey=True). Proplot will let each subplot's ylim be the same; however, Ultraplot will only remove the y-tick labels from subplots that are not on the leftmost side, even though their y-limits differ.
ah I see what you mean now. This is indeed not what it should look like. It
is odd because I didn't touch this part of the code when making it
compatible with 3.9. Then this request is turning into a bug :-')!
@cvanelteren I have been thinking about this, and one of the elegant ways to make sub-figures rather than using axes. Here is an idea: if we can convert a group of axes to a subfigure, then sharing labels would be made easy.
I think this can be done using sub-figures. For example,
I am aware of subfigures and I think this is indeed a nice way to approach it; however I still think that's a lot of boiler plate for just spanning some labels. Will keep this in mind tho was I am not currently working on this problem.
Activity
pratiman-91 commentedon Jan 12, 2025
I think it would be a nice feature to add.
cvanelteren commentedon Jan 13, 2025
So apparantly the codebase already have something in place to do this. For example I could write
Neat!
However, it gets a bit funky with more complicated demands:
Produced by
cvanelteren commentedon Jan 13, 2025
I will do some more digging as the codebase has the right functions to get this working
Mickychen00 commentedon Jan 14, 2025
Hi. I found when I set sharey = 3 or sharey = True. It seems that just yticklabels were removed but not real sharey.

Case sharey = 3
Case sharey = 0

Currently, I need to set specific ylim to let them be real "shared"
I don't know if it's related to this feature.
cvanelteren commentedon Jan 14, 2025
It's related but not the same. The docs state
I want this feature to be available on a subset of axes not all or nothing.
Mickychen00 commentedon Jan 14, 2025
Great idea. More granular subgraph labeling.

By the way, I just tested the same code in Proplot (off course using old matplotlib == 3.4.3 and numpy == 1.23.0)
It shows rightly comprared to the newest version of Ultraplot.
Apparently, I can explicitly set them by "ylim" by way of compromise.
Is it related to matplotlib's code changes?
cvanelteren commentedon Jan 14, 2025
What do you mean that it looks righly? Ultraplot support newer versions of mpl than 3.4.3 and is not backwards compatible with <3.9
Mickychen00 commentedon Jan 14, 2025
I mean when I set fig_sd = pplt.figure(sharey='all') or fig_sd = pplt.figure(sharey=True). Proplot will let each subplot's ylim be the same; however, Ultraplot will only remove the y-tick labels from subplots that are not on the leftmost side, even though their y-limits differ.
cvanelteren commentedon Jan 14, 2025
cvanelteren commentedon Jan 14, 2025
Think I found the issue! https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.6.0.html#groupers-from-get-shared-x-axes-get-shared-y-axes-will-be-immutable
made some local changes and now it is sharing properly. Will make a PR for this for review
Mickychen00 commentedon Jan 14, 2025
Great to hear it! Thanks for the prompt fix.
cvanelteren commentedon Feb 16, 2025
Small update, getting some interesting results:
code
pratiman-91 commentedon Apr 20, 2025
@cvanelteren I have been thinking about this, and one of the elegant ways to make
sub-figuresrather than usingaxes. Here is an idea: if we can convert a group ofaxesto asubfigure, then sharing labels would be made easy.I think this can be done using sub-figures. For example,
will yield
cvanelteren commentedon Apr 21, 2025
Hmm maybe you are right. I have little experience with subfigures. At the time they were a bit limited. Will have a look soon.
pratiman-91 commentedon Aug 2, 2025
@cvanelteren Maybe this could help to close this ticket and can be added in the documentation.
cvanelteren commentedon Aug 3, 2025
I am aware of subfigures and I think this is indeed a nice way to approach it; however I still think that's a lot of boiler plate for just spanning some labels. Will keep this in mind tho was I am not currently working on this problem.
cvanelteren commentedon Jan 11, 2026
Implemented on main.