MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_thetalim

Method set_thetalim

lib/matplotlib/projections/polar.py:1043–1070  ·  view source on GitHub ↗

r""" Set the minimum and maximum theta values. Can take the following signatures: - ``set_thetalim(minval, maxval)``: Set the limits in radians. - ``set_thetalim(thetamin=minval, thetamax=maxval)``: Set the limits in degrees. where minval and maxv

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

1041 return np.rad2deg(self.viewLim.xmin)
1042
1043 def set_thetalim(self, *args, **kwargs):
1044 r"""
1045 Set the minimum and maximum theta values.
1046
1047 Can take the following signatures:
1048
1049 - ``set_thetalim(minval, maxval)``: Set the limits in radians.
1050 - ``set_thetalim(thetamin=minval, thetamax=maxval)``: Set the limits
1051 in degrees.
1052
1053 where minval and maxval are the minimum and maximum limits. Values are
1054 wrapped in to the range :math:`[0, 2\pi]` (in radians), so for example
1055 it is possible to do ``set_thetalim(-np.pi / 2, np.pi / 2)`` to have
1056 an axis symmetric around 0. A ValueError is raised if the absolute
1057 angle difference is larger than a full circle.
1058 """
1059 orig_lim = self.get_xlim() # in radians
1060 if 'thetamin' in kwargs:
1061 kwargs['xmin'] = np.deg2rad(kwargs.pop('thetamin'))
1062 if 'thetamax' in kwargs:
1063 kwargs['xmax'] = np.deg2rad(kwargs.pop('thetamax'))
1064 new_min, new_max = self.set_xlim(*args, **kwargs)
1065 # Parsing all permutations of *args, **kwargs is tricky; it is simpler
1066 # to let set_xlim() do it and then validate the limits.
1067 if abs(new_max - new_min) > 2 * np.pi:
1068 self.set_xlim(orig_lim) # un-accept the change
1069 raise ValueError("The angle range must be less than a full circle")
1070 return tuple(np.rad2deg((new_min, new_max)))
1071
1072 def set_theta_offset(self, offset):
1073 """

Callers 4

test_thetalim_argsFunction · 0.80

Calls 3

get_xlimMethod · 0.45
popMethod · 0.45
set_xlimMethod · 0.45

Tested by 4

test_thetalim_argsFunction · 0.64