From ba0f34174e24f2fa59ecd6891ef67f17e3ae02d3 Mon Sep 17 00:00:00 2001 From: Matt Adamson Date: Tue, 13 Mar 2018 22:30:23 -0400 Subject: [PATCH 1/5] updated documentation Update polar.py Added documentation to set_rlim and other undocumented functions Update polar.py Fixed spacing errors --- lib/matplotlib/projections/polar.py | 47 +++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 2156514fd7d0..e6a98678ce72 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1022,6 +1022,13 @@ def get_thetamin(self): return np.rad2deg(self.viewLim.xmin) def set_thetalim(self, *args, **kwargs): + """Set the minimum and maxium radius + ---------- + thetamin + Updates the thetamin value. + thetamax + Updates the thetamax value. + """ if 'thetamin' in kwargs: kwargs['xmin'] = np.deg2rad(kwargs.pop('thetamin')) if 'thetamax' in kwargs: @@ -1100,21 +1107,59 @@ def get_theta_direction(self): return self._direction.get_matrix()[0, 0] def set_rmax(self, rmax): + """Update the maximum radius + + Parameters + ---------- + rmax : number + Set maximum radius to value rmax. + """ self.viewLim.y1 = rmax def get_rmax(self): + """ + Returns + ------- + float + The maximum radius of chart. + """ return self.viewLim.ymax def set_rmin(self, rmin): + """Updates the minimum radius + Parameters + ---------- + rmin : number + Set minimumradius to value rmin. + """ self.viewLim.y0 = rmin def get_rmin(self): + """ + Returns + ------- + float + The minimum radius of chart. + """ return self.viewLim.ymin def set_rorigin(self, rorigin): + """Updates the chart origin + + Parameters + ---------- + rorigin : number + Set the chart origin value. + """ self._originViewLim.locked_y0 = rorigin def get_rorigin(self): + """ + Returns + ------- + float + The origin of chart. + """ return self._originViewLim.y0 def get_rsign(self): @@ -1349,7 +1394,6 @@ def get_data_ratio(self): def can_zoom(self): """ Return *True* if this axes supports the zoom box button functionality. - Polar axes do not support zoom boxes. """ return False @@ -1357,7 +1401,6 @@ def can_zoom(self): def can_pan(self): """ Return *True* if this axes supports the pan/zoom button functionality. - For polar axes, this is slightly misleading. Both panning and zooming are performed by the same button. Panning is performed in azimuth while zooming is done along the radial. From c5bba4c1b30b7ce2ebca384067058886c160faf2 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 19 May 2019 12:58:50 +0100 Subject: [PATCH 2/5] Update polar updates --- lib/matplotlib/projections/polar.py | 37 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index e6a98678ce72..30be8e879934 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1022,12 +1022,13 @@ def get_thetamin(self): return np.rad2deg(self.viewLim.xmin) def set_thetalim(self, *args, **kwargs): - """Set the minimum and maxium radius + """ + Set the minimum and maxium theta values. ---------- - thetamin - Updates the thetamin value. - thetamax - Updates the thetamax value. + thetamin : scalar + Minimum value in degrees. + thetamax : scalar + Maximum value in degrees. """ if 'thetamin' in kwargs: kwargs['xmin'] = np.deg2rad(kwargs.pop('thetamin')) @@ -1107,12 +1108,12 @@ def get_theta_direction(self): return self._direction.get_matrix()[0, 0] def set_rmax(self, rmax): - """Update the maximum radius + """ + Set the outer radial limit. Parameters ---------- - rmax : number - Set maximum radius to value rmax. + rmax : scalar """ self.viewLim.y1 = rmax @@ -1121,16 +1122,17 @@ def get_rmax(self): Returns ------- float - The maximum radius of chart. + Outer radial limit. """ return self.viewLim.ymax def set_rmin(self, rmin): - """Updates the minimum radius + """ + Set the inner radial limit. + Parameters ---------- - rmin : number - Set minimumradius to value rmin. + rmin : scalar """ self.viewLim.y0 = rmin @@ -1139,17 +1141,17 @@ def get_rmin(self): Returns ------- float - The minimum radius of chart. + The inner radial limit. """ return self.viewLim.ymin def set_rorigin(self, rorigin): - """Updates the chart origin + """ + Update the radial origin. Parameters ---------- - rorigin : number - Set the chart origin value. + rorigin : scalar """ self._originViewLim.locked_y0 = rorigin @@ -1158,7 +1160,6 @@ def get_rorigin(self): Returns ------- float - The origin of chart. """ return self._originViewLim.y0 @@ -1394,6 +1395,7 @@ def get_data_ratio(self): def can_zoom(self): """ Return *True* if this axes supports the zoom box button functionality. + Polar axes do not support zoom boxes. """ return False @@ -1401,6 +1403,7 @@ def can_zoom(self): def can_pan(self): """ Return *True* if this axes supports the pan/zoom button functionality. + For polar axes, this is slightly misleading. Both panning and zooming are performed by the same button. Panning is performed in azimuth while zooming is done along the radial. From cc25fbc30850a1fea81586f0d6bda4afb110ad36 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 19 May 2019 18:18:36 +0100 Subject: [PATCH 3/5] scalar > float Co-Authored-By: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/projections/polar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 30be8e879934..81d41678d42c 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1113,7 +1113,7 @@ def set_rmax(self, rmax): Parameters ---------- - rmax : scalar + rmax : float """ self.viewLim.y1 = rmax @@ -1132,7 +1132,7 @@ def set_rmin(self, rmin): Parameters ---------- - rmin : scalar + rmin : float """ self.viewLim.y0 = rmin @@ -1151,7 +1151,7 @@ def set_rorigin(self, rorigin): Parameters ---------- - rorigin : scalar + rorigin : float """ self._originViewLim.locked_y0 = rorigin From f2eacc188a8d19be82be2a3c33518d1a08094aab Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 19 May 2019 18:19:38 +0100 Subject: [PATCH 4/5] Add parameters heading --- lib/matplotlib/projections/polar.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 81d41678d42c..4687fb56152d 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1023,7 +1023,9 @@ def get_thetamin(self): def set_thetalim(self, *args, **kwargs): """ - Set the minimum and maxium theta values. + Set the minimum and maximum theta values. + + Parameters ---------- thetamin : scalar Minimum value in degrees. From f82a8518a2fda6e02be33e6b41a75faf844f8889 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 19 May 2019 22:12:57 +0100 Subject: [PATCH 5/5] Apply suggestions from code review Co-Authored-By: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/projections/polar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 4687fb56152d..e8837a7a7340 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1027,9 +1027,9 @@ def set_thetalim(self, *args, **kwargs): Parameters ---------- - thetamin : scalar + thetamin : float Minimum value in degrees. - thetamax : scalar + thetamax : float Maximum value in degrees. """ if 'thetamin' in kwargs: