Add ps.no_spines() for imshow/pcolormesh/2D-histogram plots
Image- and bin-indexed plots have no meaningful x baseline, so the themed bottom spine kept by use() doesn't apply to them. Adds an explicit opt-in to disable all spines on such Axes, documents it in plotstyle/CLAUDE.md, and updates the showcase notebook's colormap and multi-panel examples to use it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,20 @@ def new_figure(
|
||||
return fig, axes
|
||||
|
||||
|
||||
def no_spines(ax: Union[Axes, np.ndarray]) -> None:
|
||||
"""Hide every spine on `ax` — pass a single Axes or an array of them.
|
||||
|
||||
`use()` keeps only the bottom spine visible, since most plots have a
|
||||
meaningful x baseline. Pixel/bin-indexed plots (`imshow`, `pcolormesh`,
|
||||
2D histograms) don't — there's no "zero" the bottom spine anchors to —
|
||||
so call this on their Axes instead of leaving the themed bottom spine on
|
||||
or hand-rolling `ax.spines[...].set_visible(False)`.
|
||||
"""
|
||||
for single_ax in [ax] if isinstance(ax, Axes) else np.ravel(ax):
|
||||
for spine in single_ax.spines.values():
|
||||
spine.set_visible(False)
|
||||
|
||||
|
||||
def colorbar(mappable, ax: Axes, size: str = "5%", pad: float = 0.05, **kwargs) -> Colorbar:
|
||||
"""Add a colorbar matched to `ax`'s actual on-screen size.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user