8000 FIX: Make stem() baseline follow the curvature in polar plots · Anselmoo/matplotlib@0225617 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0225617

Browse files
committed
FIX: Make stem() baseline follow the curvature in polar plots
Note: There's precedence for a similar special-casing on polar Axes for errorbars: https://github.com/matplotlib/matplotlib/blob/3fb9c0961b5c8d5753c88ac37c08cda58a4b7839/lib/matplotlib/axes/_axes.py#L3798
1 parent 3fb9c09 commit 0225617

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,6 +3194,8 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
31943194
baseline, = self.plot(baseline_x, baseline_y,
31953195
color=basecolor, linestyle=basestyle,
31963196
marker=basemarker, label="_nolegend_")
3197+
baseline.get_path()._interpolation_steps = \
3198+
mpl.axis.GRIDLINE_INTERPOLATION_STEPS
31973199

31983200
stem_container = StemContainer((markerline, stemlines, baseline),
31993201
label=label)

lib/matplotlib/tests/test_axes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4617,6 +4617,17 @@ def test_stem_orientation():
46174617
orientation='horizontal')
46184618

46194619

4620+
def test_stem_polar_baseline():
4621+
"""Test that the baseline is interpolated so that it will follow the radius."""
4622+
fig = plt.figure()
4623+
ax = fig.add_subplot(projection='polar')
4624+
x = np.linspace(1.57, 3.14, 10)
4625+
y = np.linspace(0, 1, 10)
4626+
bottom = 0.5
4627+
container = ax.stem(x, y, bottom=bottom)
4628+
assert container.baseline.get_path()._interpolation_steps > 100
4629+
4630+
46204631
@image_comparison(['hist_stacked_stepfilled_alpha'])
46214632
def test_hist_stacked_stepfilled_alpha():
46224633
# make some data

0 commit comments

Comments
 (0)
0