diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index c4967025e136..3135be8798f2 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3194,6 +3194,8 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0, baseline, = self.plot(baseline_x, baseline_y, color=basecolor, linestyle=basestyle, marker=basemarker, label="_nolegend_") + baseline.get_path()._interpolation_steps = \ + mpl.axis.GRIDLINE_INTERPOLATION_STEPS stem_container = StemContainer((markerline, stemlines, baseline), label=label) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 237a0a044253..97abc750b9ef 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4617,6 +4617,17 @@ def test_stem_orientation(): orientation='horizontal') +def test_stem_polar_baseline(): + """Test that the baseline is interpolated so that it will follow the radius.""" + fig = plt.figure() + ax = fig.add_subplot(projection='polar') + x = np.linspace(1.57, 3.14, 10) + y = np.linspace(0, 1, 10) + bottom = 0.5 + container = ax.stem(x, y, bottom=bottom) + assert container.baseline.get_path()._interpolation_steps > 100 + + @image_comparison(['hist_stacked_stepfilled_alpha']) def test_hist_stacked_stepfilled_alpha(): # make some data