Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 179037c

Browse filesBrowse files
committed
STY: PEP8 the rest of PolarAxes code.
1 parent aac76e0 commit 179037c
Copy full SHA for 179037c

File tree

Expand file treeCollapse file tree

2 files changed

+35
-27
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+35
-27
lines changed

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+35-26Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,8 @@ def _set_lim_and_transforms(self):
526526
self._yaxis_text_transform = mtransforms.TransformWrapper(
527527
self._r_label_position + self.transData)
528528

529-
def get_xaxis_transform(self,which='grid'):
530-
if which not in ['tick1','tick2','grid']:
529+
def get_xaxis_transform(self, which='grid'):
530+
if which not in ['tick1', 'tick2', 'grid']:
531531
msg = "'which' must be one of [ 'tick1' | 'tick2' | 'grid' ]"
532532
raise ValueError(msg)
533533
return self._xaxis_transform
@@ -538,8 +538,8 @@ def get_xaxis_text1_transform(self, pad):
538538
def get_xaxis_text2_transform(self, pad):
539539
return self._xaxis_text2_transform, 'center', 'center'
540540

541-
def get_yaxis_transform(self,which='grid'):
542-
if which not in ['tick1','tick2','grid']:
541+
def get_yaxis_transform(self, which='grid'):
542+
if which not in ['tick1', 'tick2', 'grid']:
543543
msg = "'which' must be on of [ 'tick1' | 'tick2' | 'grid' ]"
544544
raise ValueError(msg)
545545
return self._yaxis_transform
@@ -686,7 +686,7 @@ def set_theta_zero_location(self, loc, offset=0.0):
686686
'S': np.pi * 1.5,
687687
'SE': np.pi * 1.75,
688688
'E': 0,
689-
'NE': np.pi * 0.25 }
689+
'NE': np.pi * 0.25}
690690
return self.set_theta_offset(mapping[loc] + np.deg2rad(offset))
691691

692692
def set_theta_direction(self, direction):
@@ -707,7 +707,8 @@ def set_theta_direction(self, direction):
707707
elif direction in (1, -1):
708708
mtx[0, 0] = direction
709709
else:
710-
raise ValueError("direction must be 1, -1, clockwise or counterclockwise")
710+
raise ValueError(
711+
"direction must be 1, -1, clockwise or counterclockwise")
711712
self._direction.invalidate()
712713

713714
def get_theta_direction(self):
@@ -773,6 +774,7 @@ def set_yscale(self, *args, **kwargs):
773774

774775
def set_rscale(self, *args, **kwargs):
775776
return Axes.set_yscale(self, *args, **kwargs)
777+
776778
def set_rticks(self, *args, **kwargs):
777779
return Axes.set_yticks(self, *args, **kwargs)
778780

@@ -857,7 +859,8 @@ def set_rgrids(self, radii, labels=None, angle=None, fmt=None,
857859

858860
def set_xscale(self, scale, *args, **kwargs):
859861
if scale != 'linear':
860-
raise NotImplementedError("You can not set the xscale on a polar plot.")
862+
raise NotImplementedError(
863+
"You can not set the xscale on a polar plot.")
861864

862865
def format_coord(self, theta, r):
863866
"""
@@ -868,7 +871,9 @@ def format_coord(self, theta, r):
868871
# \u03b8: lower-case theta
869872
# \u03c0: lower-case pi
870873
# \u00b0: degree symbol
871-
return '\u03b8=%0.3f\u03c0 (%0.3f\u00b0), r=%0.3f' % (theta, theta * 180.0, r)
874+
return '\u03b8=%0.3f\u03c0 (%0.3f\u00b0), r=%0.3f' % (theta,
875+
theta * 180.0,
876+
r)
872877

873878
def get_data_ratio(self):
874879
'''
@@ -877,7 +882,7 @@ def get_data_ratio(self):
877882
'''
878883
return 1.0
879884

880-
### Interactive panning
885+
# # # Interactive panning
881886

882887
def can_zoom(self):
883888
"""
@@ -887,7 +892,7 @@ def can_zoom(self):
887892
"""
888893
return False
889894

890-
def can_pan(self) :
895+
def can_pan(self):
891896
"""
892897
Return *True* if this axes supports the pan/zoom button functionality.
893898
@@ -909,14 +914,13 @@ def start_pan(self, x, y, button):
909914
mode = 'zoom'
910915

911916
self._pan_start = cbook.Bunch(
912-
rmax = self.get_rmax(),
913-
trans = self.transData.frozen(),
914-
trans_inverse = self.transData.inverted().frozen(),
915-
r_label_angle = self.get_rlabel_position(),
916-
x = x,
917-
y = y,
918-
mode = mode
919-
)
917+
rmax=self.get_rmax(),
918+
trans=self.transData.frozen(),
919+
trans_inverse=self.transData.inverted().frozen(),
920+
r_label_angle=self.get_rlabel_position(),
921+
x=x,
922+
y=y,
923+
mode=mode)
920924

921925
def end_pan(self):
922926
del self._pan_start
@@ -987,7 +991,8 @@ def drag_pan(self, button, key, x, y):
987991
# vertices = self.transform(vertices)
988992

989993
# result = np.zeros((len(vertices) * 3 - 2, 2), np.float_)
990-
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ), mpath.Path.code_type)
994+
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ),
995+
# mpath.Path.code_type)
991996
# result[0] = vertices[0]
992997
# codes[0] = mpath.Path.MOVETO
993998

@@ -1024,8 +1029,8 @@ def drag_pan(self, button, key, x, y):
10241029

10251030
# result[3::3] = p1
10261031

1027-
# print vertices[-2:]
1028-
# print result[-2:]
1032+
# print(vertices[-2:])
1033+
# print(result[-2:])
10291034

10301035
# return mpath.Path(result, codes)
10311036

@@ -1039,12 +1044,13 @@ def drag_pan(self, button, key, x, y):
10391044
# maxtd = td.max()
10401045
# interpolate = np.ceil(maxtd / halfpi)
10411046

1042-
# print "interpolate", interpolate
1047+
# print("interpolate", interpolate)
10431048
# if interpolate > 1.0:
10441049
# vertices = self.interpolate(vertices, interpolate)
10451050

10461051
# result = np.zeros((len(vertices) * 3 - 2, 2), np.float_)
1047-
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ), mpath.Path.code_type)
1052+
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ),
1053+
# mpath.Path.code_type)
10481054
# result[0] = vertices[0]
10491055
# codes[0] = mpath.Path.MOVETO
10501056

@@ -1066,16 +1072,19 @@ def drag_pan(self, button, key, x, y):
10661072

10671073
# result[1::3, 0] = t0 + (tkappa * td_scaled)
10681074
# result[1::3, 1] = r0*hyp_kappa
1069-
# # result[1::3, 1] = r0 / np.cos(tkappa * td_scaled) # np.sqrt(r0*r0 + ravg_kappa*ravg_kappa)
1075+
# # result[1::3, 1] = r0 / np.cos(tkappa * td_scaled)
1076+
# # np.sqrt(r0*r0 + ravg_kappa*ravg_kappa)
10701077

10711078
# result[2::3, 0] = t1 - (tkappa * td_scaled)
10721079
# result[2::3, 1] = r1*hyp_kappa
1073-
# # result[2::3, 1] = r1 / np.cos(tkappa * td_scaled) # np.sqrt(r1*r1 + ravg_kappa*ravg_kappa)
1080+
# # result[2::3, 1] = r1 / np.cos(tkappa * td_scaled)
1081+
# # np.sqrt(r1*r1 + ravg_kappa*ravg_kappa)
10741082

10751083
# result[3::3, 0] = t1
10761084
# result[3::3, 1] = r1
10771085

1078-
# print vertices[:6], result[:6], t0[:6], t1[:6], td[:6], td_scaled[:6], tkappa
1086+
# print(vertices[:6], result[:6], t0[:6], t1[:6], td[:6],
1087+
# td_scaled[:6], tkappa)
10791088
# result = self.transform(result)
10801089
# return mpath.Path(result, codes)
10811090
# transform_path_non_affine = transform_path

‎lib/matplotlib/tests/test_coding_standards.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_coding_standards.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ def test_pep8_conformance_installed_files():
243243
'sphinxext/plot_directive.py',
244244
'projections/__init__.py',
245245
'projections/geo.py',
246-
'projections/polar.py',
247246
'externals/six.py']
248247
expected_bad_files = ['*/matplotlib/' + s for s in expected_bad_files]
249248
assert_pep8_conformance(module=matplotlib,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.