diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index ea9bb7a2c228..a9d98444ace4 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1856,6 +1856,8 @@ def add_patch(self, p): if p.get_clip_path() is None: p.set_clip_path(self.patch) self._update_patch_limits(p) + if self.name != 'rectilinear': + p.get_path()._interpolation_steps = max(p.get_path()._interpolation_steps, 100) self.patches.append(p) p._remove_method = lambda h: self.patches.remove(h) return p diff --git a/lib/matplotlib/tests/baseline_images/test_patches/polar_proj.png b/lib/matplotlib/tests/baseline_images/test_patches/polar_proj.png new file mode 100644 index 000000000000..9495ec500679 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_patches/polar_proj.png differ diff --git a/lib/matplotlib/tests/test_patches.py b/lib/matplotlib/tests/test_patches.py index f7722241e47b..3b55c284214b 100644 --- a/lib/matplotlib/tests/test_patches.py +++ b/lib/matplotlib/tests/test_patches.py @@ -337,3 +337,17 @@ def test_multi_color_hatch(): with mstyle.context({'hatch.color': 'C{}'.format(i)}): r = Rectangle((i-.8/2, 5), .8, 1, hatch='//', fc='none') ax.add_patch(r) + + +@image_comparison(baseline_images=['polar_proj'], extensions=['png']) +def test_adding_rectangle_patch_with_polar_projection(): + fig = plt.figure() + ax = fig.add_subplot(111, projection='polar') + + # add quadrant as example + ax.add_patch( + mpatches.Rectangle( + (0, 1), width=np.pi * 0.5, height=0.5 + ) + ) + ax.set_rmax(2)