8000 fixed theta > 2pi bug issue # 16501 · matplotlib/matplotlib@a6929f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6929f3

Browse files
committed
fixed theta > 2pi bug issue # 16501
1 parent 3205ff7 commit a6929f3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/matplotlib/projections/polar.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,10 +989,23 @@ def set_thetalim(self, *args, **kwargs):
989989
it is possible to do ``set_thetalim(-np.pi / 2, np.pi / 2)`` to have
990990
an axes symmetric around 0.
991991
"""
992+
thetamin = 0
993+
thetamax = 0
992994
if 'thetamin' in kwargs:
993-
kwargs['xmin'] = np.deg2rad(kwargs.pop('thetamin'))
995+
thetamin = np.deg2rad(kwargs.pop('thetamin'))
996+
kwargs['xmin'] = thetamin
994997
if 'thetamax' in kwargs:
995-
kwargs['xmax'] = np.deg2rad(kwargs.pop('thetamax'))
998+
thetamax = np.deg2rad(kwargs.pop('thetamax'))
999+
kwargs['xmax'] = thetamax
1000+
1001+
if args.__len__() == 2:
1002+
if args[0] is not None and args[1] is not None:
1003+
if(abs(args[1] - args[0]) > 2 * np.pi):
1004+
raise TypeError('Cannot pass angle range > 2 pi')
1005+
1006+
if 'xmin' in kwargs and 'xmax' in kwargs:
1007+
if(abs(thetamax - thetamin) > 2 * np.pi):
1008+
raise TypeError('Cannot pass angle range > 2 pi')
9961009
return tuple(np.rad2deg(self.set_xlim(*args, **kwargs)))
9971010

9981011
def set_theta_offset(self, offset):

0 commit comments

Comments
 (0)
0