@@ -988,28 +988,27 @@ def set_thetalim(self, *args, **kwargs):
988
988
wrapped in to the range :math:`[0, 2\pi]` (in radians), so for example
989
989
it is possible to do ``set_thetalim(-np.pi / 2, np.pi / 2)`` to have
990
990
an axes symmetric around 0. A ValueError is raised if the absolute
991
- angle difference is larger than :math:2\pi.
991
+ angle difference is larger than :math:` 2\pi` .
992
992
"""
993
993
thetamin = None
994
994
thetamax = None
995
995
left = None
996
996
right = None
997
997
998
+ if len (args ) == 2 :
999
+ if args [0 ] is not None and args [1 ] is not None :
1000
+ left , right = args
1001
+ if abs (right - left ) > 2 * np .pi :
1002
+ raise ValueError ('The angle range must be <= 2 pi' )
1003
+
998
1004
if 'thetamin' in kwargs :
999
1005
thetamin = np .deg2rad (kwargs .pop ('thetamin' ))
1000
1006
if 'thetamax' in kwargs :
1001
1007
thetamax = np .deg2rad (kwargs .pop ('thetamax' ))
1002
1008
1003
- if len (args ) == 2 :
1004
- if args [0 ] is not None and args [1 ] is not None :
1005
- left = args [0 ]
1006
- right = args [1 ]
1007
- if (abs (right - left ) > 2 * np .pi ):
1008
- raise ValueError ('Cannot pass angle range > 2 pi' )
1009
-
1010
- if (thetamin is not None and thetamax is not None ):
1011
- if (abs (thetamax - thetamin ) > 2 * np .pi ):
1012
- raise ValueError ('Cannot pass angle range > 2 pi' )
1009
+ if thetamin is not None and thetamax is not None :
1010
+ if abs (thetamax - thetamin ) > 2 * np .pi :
1011
+ raise ValueError ('The angle range must be<= 360 degrees' )
1013
1012
return tuple (np .rad2deg (self .set_xlim (left = left , right = right ,
1014
1013
xmin = thetamin , xmax = thetamax )))
1015
1014
0 commit comments