mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.18k stars 1.89k forks source link

[Fix] Objects interface - use axis preconfigured label position #3696

Open MaozGelbart opened 1 month ago

MaozGelbart commented 1 month ago

Issue #3614 describes an incorrect behavior of labeling/ticking of yaxis in the case of using secondary axis (through twin axes). In twin axes (instantiated through ax.twin{x|y}), the source axes are duplicated in a manner that makes one axis (for example xaxis) shared with the other (but its label is hidden), while the other axis is visible, but its ticks are plotted on the opposing side (for example yaxis using the right side for labeling and ticking). Prior to this PR, seaboard objects figure setup code assumes that yaxis uses the left side, and xaxis uses the bottom side.

This PR changes the way plot setup is labeling/ticking the relevant axis, and pulls the label location information directly from the axis objects. This way, it correctly labels axis that already set the label to the opposing side (top/right; compared to the common bottom/left axis labeling).

Fixes #3614 (attached its reprex after this PR).

3614