Skip to content

Commit cab5dcc

Browse files
authored
Code style cleanup (#16044)
Code style cleanup
2 parents 3261ed2 + fca65ed commit cab5dcc

File tree

26 files changed

+44
-48
lines changed

26 files changed

+44
-48
lines changed

examples/images_contours_and_fields/contourf_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# A low hump with a spike coming out.
2121
# Needs to have z/colour axis on a log scale so we see both hump and spike.
2222
# linear scale only shows the spike.
23-
Z1 = np.exp(-(X)**2 - (Y)**2)
23+
Z1 = np.exp(-X**2 - Y**2)
2424
Z2 = np.exp(-(X * 10)**2 - (Y * 10)**2)
2525
z = Z1 + 50 * Z2
2626

examples/images_contours_and_fields/pcolor_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
# A low hump with a spike coming out.
9090
# Needs to have z/colour axis on a log scale so we see both hump and spike.
9191
# linear scale only shows the spike.
92-
Z1 = np.exp(-(X)**2 - (Y)**2)
92+
Z1 = np.exp(-X**2 - Y**2)
9393
Z2 = np.exp(-(X * 10)**2 - (Y * 10)**2)
9494
Z = Z1 + 50 * Z2
9595

examples/text_labels_and_annotations/mathtext_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def doall():
7272
plt.gca().set_yticklabels("", visible=False)
7373

7474
# Gap between lines in axes coords
75-
line_axesfrac = (1. / (n_lines))
75+
line_axesfrac = 1 / n_lines
7676

7777
# Plotting header demonstration formula
7878
full_demo = mathext_demos[0]
@@ -82,7 +82,7 @@ def doall():
8282

8383
# Plotting features demonstration formulae
8484
for i_line in range(1, n_lines):
85-
baseline = 1 - (i_line) * line_axesfrac
85+
baseline = 1 - i_line * line_axesfrac
8686
baseline_next = baseline - line_axesfrac
8787
title = mathtext_titles[i_line] + ":"
8888
fill_color = ['white', mpl_blue_rvb][i_line % 2]

examples/userdemo/colormap_normalizations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# z/colour axis on a log scale so we see both hump and spike. linear
2222
# scale only shows the spike.
2323

24-
Z1 = np.exp(-(X)**2 - (Y)**2)
24+
Z1 = np.exp(-X**2 - Y**2)
2525
Z2 = np.exp(-(X * 10)**2 - (Y * 10)**2)
2626
Z = Z1 + 50 * Z2
2727

@@ -41,7 +41,7 @@
4141
# sine wave in Y. We can remove the power law using a PowerNorm.
4242

4343
X, Y = np.mgrid[0:3:complex(0, N), 0:2:complex(0, N)]
44-
Z1 = (1 + np.sin(Y * 10.)) * X**(2.)
44+
Z1 = (1 + np.sin(Y * 10.)) * X**2
4545

4646
fig, ax = plt.subplots(2, 1)
4747

examples/userdemo/colormap_normalizations_power.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
sine wave in Y. We can remove the power law using a PowerNorm.
1919
'''
2020
X, Y = np.mgrid[0:3:complex(0, N), 0:2:complex(0, N)]
21-
Z1 = (1 + np.sin(Y * 10.)) * X**(2.)
21+
Z1 = (1 + np.sin(Y * 10.)) * X**2
2222

2323
fig, ax = plt.subplots(2, 1)
2424

lib/matplotlib/_layoutbox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,15 @@ def _is_subplotspec_layoutbox(self):
350350
Helper to check if this layoutbox is the layoutbox of a
351351
subplotspec
352352
'''
353-
name = (self.name).split('.')[-1]
353+
name = self.name.split('.')[-1]
354354
return name[:2] == 'ss'
355355

356356
def _is_gridspec_layoutbox(self):
357357
'''
358358
Helper to check if this layoutbox is the layoutbox of a
359359
gridspec
360360
'''
361-
name = (self.name).split('.')[-1]
361+
name = self.name.split('.')[-1]
362362
return name[:8] == 'gridspec'
363363

364364
def find_child_subplots(self):

lib/matplotlib/animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def correct_roundoff(x, dpi, n):
8989

9090
wnew = int(w * dpi / n) * n / dpi
9191
hnew = int(h * dpi / n) * n / dpi
92-
return (correct_roundoff(wnew, dpi, n), correct_roundoff(hnew, dpi, n))
92+
return correct_roundoff(wnew, dpi, n), correct_roundoff(hnew, dpi, n)
9393

9494

9595
# A registry for available MovieWriter classes

lib/matplotlib/artist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ def axes(self, new_axes):
200200
self._axes = new_axes
201201
if new_axes is not None and new_axes is not self:
202202
self.stale_callback = _stale_axes_callback
203-
return new_axes
204203

205204
@property
206205
def stale(self):

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def invert(x):
610610
secax.set_xlabel('Period [s]')
611611
plt.show()
612612
"""
613-
if (location in ['top', 'bottom'] or isinstance(location, Number)):
613+
if location in ['top', 'bottom'] or isinstance(location, Number):
614614
secondary_ax = SecondaryAxis(self, 'x', location, functions,
615615
**kwargs)
616616
self.add_child_axes(secondary_ax)

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,7 @@ def tol(x): return 1e-5 * abs(x) + 1e-8
25232523
'minposy', self.yaxis, self._ymargin, y_stickies, self.set_ybound)
25242524

25252525
def _get_axis_list(self):
2526-
return (self.xaxis, self.yaxis)
2526+
return self.xaxis, self.yaxis
25272527

25282528
def _get_axis_map(self):
25292529
"""
@@ -3966,7 +3966,7 @@ def _get_view(self):
39663966
"""
39673967
xmin, xmax = self.get_xlim()
39683968
ymin, ymax = self.get_ylim()
3969-
return (xmin, xmax, ymin, ymax)
3969+
return xmin, xmax, ymin, ymax
39703970

39713971
def _set_view(self, view):
39723972
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy