Skip to content

Commit 9a5c752

Browse files
iangowclaude
andcommitted
Expose theta_label_pad parameter on coord_radial
Replaces the hard-coded pad=8 with a user-facing theta_label_pad parameter (default 8) so callers can tune the gap between the outer circle spine and theta tick labels without post-processing the figure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e51f6ea commit 9a5c752

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

plotnine/coords/coord_radial.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class coord_radial(coord_polar):
6868
circle for full-circle plots, using the breaks and labels from the
6969
theta scale. Default ``False``. Partial-arc plots always show
7070
theta labels (filtered to the visible arc) regardless of this flag.
71+
theta_label_pad :
72+
Distance in points between the outer circle spine and the theta tick
73+
labels. Default ``8``. Only applied when theta labels are shown.
7174
"""
7275

7376
def __init__(
@@ -83,6 +86,7 @@ def __init__(
8386
thetalim: tuple[float, float] | None = None,
8487
rlim: tuple[float, float] | None = None,
8588
theta_labels: bool = False,
89+
theta_label_pad: float = 8,
8690
) -> None:
8791
super().__init__(
8892
theta=theta,
@@ -97,6 +101,7 @@ def __init__(
97101
self.thetalim = thetalim
98102
self.rlim = rlim
99103
self.theta_labels = theta_labels
104+
self.theta_label_pad = theta_label_pad
100105

101106
# ------------------------------------------------------------------
102107
# Panel params
@@ -252,4 +257,4 @@ def draw(self, axs: list[Axes]) -> None:
252257
# Push theta tick labels away from the outer circle so they don't
253258
# sit right on the spine.
254259
if self.theta_labels or self.end is not None:
255-
ax.tick_params(axis="x", pad=8)
260+
ax.tick_params(axis="x", pad=self.theta_label_pad)

0 commit comments

Comments
 (0)