@@ -1316,6 +1316,8 @@ def show(
13161316 dpi : int | None = None ,
13171317 fig : Figure | None = None ,
13181318 title : list [str ] | str | None = None ,
1319+ xlabel : str | None = None ,
1320+ ylabel : str | None = None ,
13191321 pad_extent : int | float = 0 ,
13201322 crop_coord : tuple [float , float , float , float ] | None = None ,
13211323 ax : list [Axes ] | Axes | None = None ,
@@ -1380,6 +1382,10 @@ def show(
13801382 Title(s) for the plot. A single string is applied to all panels; a list must match the number
13811383 of panels. If ``None``, each panel is titled with its coordinate system name, or, in multi-panel
13821384 color mode, with its color key.
1385+ xlabel : str | None, default None
1386+ Label for the x axis, applied to every rendered panel. ``None`` leaves it unlabelled.
1387+ ylabel : str | None, default None
1388+ Label for the y axis, applied to every rendered panel. ``None`` leaves it unlabelled.
13831389 pad_extent : int | float, default 0
13841390 Padding added around the computed spatial extent on all sides. Ignored when ``crop_coord`` is set.
13851391 crop_coord : tuple[float, float, float, float] | None, default None
@@ -1456,6 +1462,8 @@ def show(
14561462 dpi = dpi ,
14571463 fig = fig ,
14581464 title = title ,
1465+ xlabel = xlabel ,
1466+ ylabel = ylabel ,
14591467 pad_extent = pad_extent ,
14601468 crop_coord = crop_coord ,
14611469 ax = ax ,
@@ -1596,6 +1604,8 @@ def show(
15961604 axis_channel_legend_entries = axis_channel_legend_entries ,
15971605 cs_row = cs_row ,
15981606 title = title ,
1607+ xlabel = xlabel ,
1608+ ylabel = ylabel ,
15991609 dpi = dpi ,
16001610 figsize = figsize ,
16011611 )
@@ -2021,15 +2031,18 @@ def _finalize_panel(
20212031 ax : Axes ,
20222032 panel_idx : int ,
20232033 title : list [str ] | None ,
2034+ xlabel : str | None ,
2035+ ylabel : str | None ,
20242036 panel_key : str | None ,
20252037 cs : str ,
20262038 frameon : bool | None ,
20272039) -> None :
2028- """Set a panel's title, equal aspect ratio and frame visibility.
2040+ """Set a panel's title, axis labels, equal aspect ratio and frame visibility.
20292041
20302042 With no explicit ``title`` the panel is labelled with its color key (multi-panel color mode)
20312043 or its coordinate-system name; a single-element list applies to every panel, otherwise the
2032- title at ``panel_idx`` is used.
2044+ title at ``panel_idx`` is used. ``xlabel``/``ylabel`` are applied to every panel; ``None``
2045+ leaves the respective axis unlabelled.
20332046 """
20342047 if title is None :
20352048 t = panel_key if panel_key is not None else cs
@@ -2039,6 +2052,10 @@ def _finalize_panel(
20392052 # len(title) == num_panels is guaranteed by the up-front check in show().
20402053 t = title [panel_idx ]
20412054 ax .set_title (t )
2055+ if xlabel is not None :
2056+ ax .set_xlabel (xlabel )
2057+ if ylabel is not None :
2058+ ax .set_ylabel (ylabel )
20422059 ax .set_aspect ("equal" )
20432060 if frameon is False :
20442061 ax .axis ("off" )
@@ -2095,6 +2112,8 @@ def _render_panel(
20952112 axis_channel_legend_entries : list [ChannelLegendEntry ],
20962113 cs_row : pd .Series ,
20972114 title : list [str ] | None ,
2115+ xlabel : str | None ,
2116+ ylabel : str | None ,
20982117 dpi : int | None ,
20992118 figsize : tuple [float , float ] | None ,
21002119) -> tuple [list [str ], dict [str , bool ]]:
@@ -2163,5 +2182,5 @@ def _render_panel(
21632182 _RENDERERS [cmd ](** kwargs )
21642183
21652184 # Panel finalization depends only on per-panel values, so run it once after the loop.
2166- _finalize_panel (ax , panel_idx , title , panel_key , cs , fig_params .frameon )
2185+ _finalize_panel (ax , panel_idx , title , xlabel , ylabel , panel_key , cs , fig_params .frameon )
21672186 return wanted_elements , wants
0 commit comments