-
Notifications
You must be signed in to change notification settings - Fork 104
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
Prevent shared-label algorithm from ignoring/overwriting distinct axis labels #384
Comments
Try set |
Labels re-appear in multitudes (i.e. expected behavior). |
The problem is this code: Lines 1185 to 1206 in 29bc955
ax._get_span_axes(pos, panels=False) returns every axes adjacent to the left edge: 1, 2, 3, 4, 5, 8 to share the same y axis label. I patched it like this:
...
axs = ax._get_span_axes(pos, panels=False) # returns panel or main axes
if any(getattr(ax, '_share' + x) for ax in axs):
continue # nothing to align or axes have parents
_ref_label_text = getattr(ax, x + 'axis').label.get_text() # PATCH
axs = list(_ax for _ax in axs if getattr(_ax, x + 'axis').label.get_text() == _ref_label_text) # PATCH
seen.update(axs)
... And the desired effect is kinda achieved. |
There might be another issue on top of this: super-label coordinates are computed incorrectly in for i in ax:
pos = i.get_subplotspec().get_position(fig)
print(f"{i=} {pos=}") before and after figure is printed I get different results. |
Thanks for the report and PR #385 -- will take a closer look when I can. Agree this makes sense -- the shared label algorithm should only consider subplots with identical labels. The sharing algorithm is pretty klunky right now. |
Description
Cannot create a subplot label.
Steps to reproduce
Expected behavior:
not ok ylabel
should be visibleActual behavior:
not ok ylabel
is absentProplot version
0.9.5.post332
3.5.2
The text was updated successfully, but these errors were encountered: