From 05cbbedca24a776a589fdc427e0e24dcb824ecd7 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 18 Apr 2021 17:10:29 +0200 Subject: [PATCH] Move restriction of polar theta scales to ThetaAxis._set_scale. This ensures that there's a single place handling the restriction of theta scales, which makes it simpler to follow (otherwise, in ThetaAxis._set_scale, it's not clear what values can be taken by `value`). --- lib/matplotlib/projections/polar.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index f66ce4731359..6e2dd8af90f3 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -389,6 +389,9 @@ def cla(self): self.clear() def _set_scale(self, value, **kwargs): + if value != 'linear': + raise NotImplementedError( + "The xscale cannot be set on a polar plot") super()._set_scale(value, **kwargs) self._wrap_locator_formatter() @@ -1391,11 +1394,6 @@ def set_rgrids(self, radii, labels=None, angle=None, fmt=None, **kwargs): t.update(kwargs) return self.yaxis.get_gridlines(), self.yaxis.get_ticklabels() - def set_xscale(self, scale, *args, **kwargs): - if scale != 'linear': - raise NotImplementedError( - "You can not set the xscale on a polar plot.") - def format_coord(self, theta, r): # docstring inherited if theta < 0: