Skip to content

Commit 61777e6

Browse files
iangowclaude
andcommitted
Fix theta breaks with negative angles causing partial-arc regression
ax.set_xticks() with negative radian values silently extends xlim below 0, converting a full circle into a partial arc. When start is chosen so that the first few months map to negative radians (e.g. start = -π/2), the theta labels passed to set_xticks triggered this matplotlib behaviour. Normalise all break positions into [0, 2π] for full-circle plots before they are stored in panel_params.x.breaks so that set_xticks never receives a negative value. Partial-arc plots are unaffected (their breaks are always within [arc_lo, arc_hi] which is already in [0, 2π]). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent aca3f93 commit 61777e6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

plotnine/coords/coord_radial.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ def setup_panel_params(self, scale_x: scale, scale_y: scale) -> panel_view:
160160
keep = [arc_lo <= r <= arc_hi for r in radian_pos]
161161
radian_pos = [r for r, k in zip(radian_pos, keep) if k]
162162
theta_labels = [l for l, k in zip(theta_labels, keep) if k]
163+
else:
164+
# Full circle: ax.set_xticks with negative values silently extends
165+
# xlim below 0, turning the full circle into a partial arc. Wrap
166+
# all break positions into [0, 2π] to avoid this.
167+
tau = 2.0 * np.pi
168+
radian_pos = [r % tau for r in radian_pos]
163169
x_updates["breaks"] = radian_pos
164170
x_updates["labels"] = theta_labels
165171

0 commit comments

Comments
 (0)