Description
Setting ylabel on a bottom panel (created via panel_axes('bottom')) overwrites the ylabel of the parent main axes, and the panel itself ends up with no ylabel. The same symmetric issue should occur for xlabel on left/right panels.
Minimal reproducer
import ultraplot as uplt
fig, axs = uplt.subplots(ncols=2, sharey=0)
pxs = axs.panel_axes('bottom')
axs.format(ylabel='ylabel')
pxs.format(ylabel='plabel')
Expected
- Both main axes show
"ylabel".
- Both bottom panels show
"plabel".
Actual
- At least one main axis displays
"plabel" (the panel's text, transferred up).
- Both panels display no ylabel.
Environment
- ultraplot 2.1.5
- matplotlib 3.10.8
- Python 3.10.20
Likely cause
In ultraplot/axes/cartesian.py::_apply_axis_sharing_for_axis, when panel_group is true the sharing level is forced to 3, which triggers labels._transfer_label(axis.label, shared_axis_obj.label) — moving the panel's ylabel text onto the parent and hiding the panel's label. For a bottom panel, the Y-axis is not geometrically aligned with the parent's Y-axis, so this transfer should not happen.
Intended gating:
- Y-label transfer only for left/right panels
- X-label transfer only for top/bottom panels
Workaround note: pax.yaxis.label.set_visible(True) after format() does not help because the text has already been moved off the panel's Text object by _transfer_label (it calls src.set_text("")).
Description
Setting
ylabelon a bottom panel (created viapanel_axes('bottom')) overwrites the ylabel of the parent main axes, and the panel itself ends up with no ylabel. The same symmetric issue should occur forxlabelon left/right panels.Minimal reproducer
Expected
"ylabel"."plabel".Actual
"plabel"(the panel's text, transferred up).Environment
Likely cause
In
ultraplot/axes/cartesian.py::_apply_axis_sharing_for_axis, whenpanel_groupis true the sharing level is forced to 3, which triggerslabels._transfer_label(axis.label, shared_axis_obj.label)— moving the panel's ylabel text onto the parent and hiding the panel's label. For a bottom panel, the Y-axis is not geometrically aligned with the parent's Y-axis, so this transfer should not happen.Intended gating:
Workaround note:
pax.yaxis.label.set_visible(True)afterformat()does not help because the text has already been moved off the panel's Text object by_transfer_label(it callssrc.set_text("")).