diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 0bff320e5728..33063674c415 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -298,7 +298,7 @@ def set_axis(self, axis): def __call__(self): lim = self.axis.get_view_interval() if _is_full_circle_deg(lim[0], lim[1]): - return np.arange(8) * 2 * np.pi / 8 + return np.deg2rad(min(lim)) + np.arange(8) * 2 * np.pi / 8 else: return np.deg2rad(self.base()) diff --git a/lib/matplotlib/tests/test_polar.py b/lib/matplotlib/tests/test_polar.py index 9d6e78da2cbc..9a1c6be6fcff 100644 --- a/lib/matplotlib/tests/test_polar.py +++ b/lib/matplotlib/tests/test_polar.py @@ -446,3 +446,11 @@ def test_polar_log(): n = 100 ax.plot(np.linspace(0, 2 * np.pi, n), np.logspace(0, 2, n)) + + +def test_polar_neg_theta_lims(): + fig = plt.figure() + ax = fig.add_subplot(projection='polar') + ax.set_thetalim(-np.pi, np.pi) + labels = [l.get_text() for l in ax.xaxis.get_ticklabels()] + assert labels == ['-180°', '-135°', '-90°', '-45°', '0°', '45°', '90°', '135°']