Skip to content

Commit

Permalink
Infer label position from target axis
Browse files Browse the repository at this point in the history
  • Loading branch information
MaozGelbart committed May 20, 2024
1 parent f3ad63d commit f00e31d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions seaborn/_core/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,8 @@ def _setup_figure(self, p: Plot, common: PlotData, layers: list[Layer]) -> None:
# axis / tick labels can be shown on interior shared axes if desired

axis_obj = getattr(ax, f"{axis}axis")
visible_side = {"x": "bottom", "y": "left"}.get(axis)
# This allows correct handling for twin{x/y} axises (GH 3614)
visible_side = axis_obj.get_label_position()
show_axis_label = (
sub[visible_side]
or not p._pair_spec.get("cross", True)
Expand All @@ -1172,8 +1173,9 @@ def _setup_figure(self, p: Plot, common: PlotData, layers: list[Layer]) -> None:
)
)
for group in ("major", "minor"):
side = {"x": "bottom", "y": "left"}[axis]
axis_obj.set_tick_params(**{f"label{side}": show_tick_labels})
axis_obj.set_tick_params(
**{f"label{visible_side}": show_tick_labels}
)
for t in getattr(axis_obj, f"get_{group}ticklabels")():
t.set_visible(show_tick_labels)

Expand Down

0 comments on commit f00e31d

Please sign in to comment.