@@ -58,7 +58,8 @@ def transform_non_affine(self, tr):
58
58
t += self ._axis .get_theta_offset ()
59
59
60
60
if self ._use_rmin and self ._axis is not None :
61
- r = r - self ._axis .get_rorigin ()
61
+ r = (r - self ._axis .get_rorigin ()) * self ._axis .get_rsign ()
62
+
62
63
mask = r < 0
63
64
x [:] = np .where (mask , np .nan , r * np .cos (t ))
64
65
y [:] = np .where (mask , np .nan , r * np .sin (t ))
@@ -169,6 +170,7 @@ def transform_non_affine(self, xy):
169
170
170
171
if self ._use_rmin and self ._axis is not None :
171
172
r += self ._axis .get_rorigin ()
173
+ r *= self ._axis .get_rsign ()
172
174
173
175
return np .concatenate ((theta , r ), 1 )
174
176
transform_non_affine .__doc__ = \
@@ -432,10 +434,9 @@ def __call__(self):
432
434
# Ensure previous behaviour with full circle non-annular views.
433
435
if self ._axes :
434
436
if _is_full_circle_rad (* self ._axes .viewLim .intervalx ):
435
- rorigin = self ._axes .get_rorigin ()
437
+ rorigin = self ._axes .get_rorigin () * self . _axes . get_rsign ()
436
438
if self ._axes .get_rmin () <= rorigin :
437
439
show_all = False
438
-
439
440
if show_all :
440
441
return self .base ()
441
442
else :
@@ -455,7 +456,7 @@ def refresh(self):
455
456
456
457
def view_limits (self , vmin , vmax ):
457
458
vmin , vmax = self .base .view_limits (vmin , vmax )
458
- return mtransforms .nonsingular (min ( 0 , vmin ) , vmax )
459
+ return mtransforms .nonsingular (vmin , vmax )
459
460
460
461
461
462
class _ThetaShift (mtransforms .ScaledTranslation ):
@@ -790,7 +791,6 @@ def __str__(self):
790
791
def get_points (self ):
791
792
if self ._invalid :
792
793
points = self ._viewLim .get_points ().copy ()
793
-
794
794
# Scale angular limits to work with Wedge.
795
795
points [:, 0 ] *= 180 / np .pi
796
796
if points [0 , 0 ] > points [1 , 0 ]:
@@ -1015,8 +1015,8 @@ def draw(self, *args, **kwargs):
1015
1015
thetamin , thetamax = np .rad2deg (self ._realViewLim .intervalx )
1016
1016
if thetamin > thetamax :
1017
1017
thetamin , thetamax = thetamax , thetamin
1018
- rmin , rmax = self ._realViewLim .intervaly - self .get_rorigin ()
1019
-
1018
+ rmin , rmax = (( self ._realViewLim .intervaly - self .get_rorigin ()) *
1019
+ self . get_rsign ())
1020
1020
if isinstance (self .patch , mpatches .Wedge ):
1021
1021
# Backwards-compatibility: Any subclassed Axes might override the
1022
1022
# patch to not be the Wedge that PolarAxes uses.
@@ -1183,6 +1183,10 @@ def set_rorigin(self, rorigin):
1183
1183
def get_rorigin (self ):
1184
1184
return self ._originViewLim .y0
1185
1185
1186
+ def get_rsign (self ):
1187
+ return np .sign (self ._originViewLim .y1 - self ._originViewLim .y0 )
1188
+
1189
+
1186
1190
def set_rlim (self , bottom = None , top = None , emit = True , auto = False , ** kwargs ):
1187
1191
"""
1188
1192
See `~.polar.PolarAxes.set_ylim`.
@@ -1259,9 +1263,6 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
1259
1263
if top is None and len (bottom ) == 2 :
1260
1264
top = bottom [1 ]
1261
1265
bottom = bottom [0 ]
1262
- if bottom >= top :
1263
- raise ValueError ('Polar axes y/r-limits must be increasing; '
1264
- 'i.e. bottom < top' )
1265
1266
1266
1267
return super ().set_ylim (bottom = bottom , top = top , emit = emit , auto = auto )
1267
1268
0 commit comments