@@ -1040,13 +1040,30 @@ def set_thetalim(self, *args, **kwargs):
10401040 where minval and maxval are the minimum and maximum limits. Values are
10411041 wrapped in to the range :math:`[0, 2\pi]` (in radians), so for example
10421042 it is possible to do ``set_thetalim(-np.pi / 2, np.pi / 2)`` to have
1043- an axes symmetric around 0.
1043+ an axes symmetric around 0. A ValueError is raised if the absolute
1044+ angle difference is larger than :math:`2\pi`.
10441045 """
1046+ thetamin = None
1047+ thetamax = None
1048+ left = None
1049+ right = None
1050+
1051+ if len (args ) == 2 :
1052+ if args [0 ] is not None and args [1 ] is not None :
1053+ left , right = args
1054+ if abs (right - left ) > 2 * np .pi :
1055+ raise ValueError ('The angle range must be <= 2 pi' )
1056+
10451057 if 'thetamin' in kwargs :
1046- kwargs [ 'xmin' ] = np .deg2rad (kwargs .pop ('thetamin' ))
1058+ thetamin = np .deg2rad (kwargs .pop ('thetamin' ))
10471059 if 'thetamax' in kwargs :
1048- kwargs ['xmax' ] = np .deg2rad (kwargs .pop ('thetamax' ))
1049- return tuple (np .rad2deg (self .set_xlim (* args , ** kwargs )))
1060+ thetamax = np .deg2rad (kwargs .pop ('thetamax' ))
1061+
1062+ if thetamin is not None and thetamax is not None :
1063+ if abs (thetamax - thetamin ) > 2 * np .pi :
1064+ raise ValueError ('The angle range must be<= 360 degrees' )
1065+ return tuple (np .rad2deg (self .set_xlim (left = left , right = right ,
1066+ xmin = thetamin , xmax = thetamax )))
10501067
10511068 def set_theta_offset (self , offset ):
10521069 """
0 commit comments