Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3d30a3

Browse files
authored
Merge pull request #19626 from QuLogic/fix-examples-e265
Clean up E265 in examples.
2 parents 451e329 + 657cee9 commit a3d30a3

File tree

17 files changed

+57
-69
lines changed

17 files changed

+57
-69
lines changed

examples/axes_grid1/demo_axes_grid2.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ def add_inner_title(ax, title, loc, **kwargs):
5858

5959
for ax, z in zip(grid, ZS):
6060
ax.cax.toggle_label(True)
61-
#axis = ax.cax.axis[ax.cax.orientation]
62-
#axis.label.set_text("counts s$^{-1}$")
63-
#axis.label.set_size(10)
64-
#axis.major_ticklabels.set_size(6)
6561

6662
grid[0].set_xticks([-2, 0])
6763
grid[0].set_yticks([-2, 0, 2])

examples/axisartist/simple_axisline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
ax.set_ylim(-2, 4)
2525
ax.set_xlabel("Label X")
2626
ax.set_ylabel("Label Y")
27-
# or
28-
#ax.axis["bottom"].label.set_text("Label X")
29-
#ax.axis["left"].label.set_text("Label Y")
27+
# Or:
28+
# ax.axis["bottom"].label.set_text("Label X")
29+
# ax.axis["left"].label.set_text("Label Y")
3030

3131
# make new (right-side) yaxis, but with some offset
3232
ax.axis["right2"] = ax.new_fixed_axis(loc="right", offset=(20, 0))

examples/color/named_colors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ def plot_colortable(colors, title, sort_colors=True, emptycols=0):
7878
plot_colortable(mcolors.TABLEAU_COLORS, "Tableau Palette",
7979
sort_colors=False, emptycols=2)
8080

81-
#sphinx_gallery_thumbnail_number = 3
81+
# sphinx_gallery_thumbnail_number = 3
8282
plot_colortable(mcolors.CSS4_COLORS, "CSS Colors")
8383

8484
# Optionally plot the XKCD colors (Caution: will produce large figure)
85-
#xkcd_fig = plot_colortable(mcolors.XKCD_COLORS, "XKCD Colors")
86-
#xkcd_fig.savefig("XKCD_Colors.png")
85+
# xkcd_fig = plot_colortable(mcolors.XKCD_COLORS, "XKCD Colors")
86+
# xkcd_fig.savefig("XKCD_Colors.png")
8787

8888
plt.show()
8989

examples/event_handling/timers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ def update_title(axes):
2626
timer.add_callback(update_title, ax)
2727
timer.start()
2828

29-
# Or could start the timer on first figure draw
30-
#def start_timer(event):
31-
# timer.start()
32-
# fig.canvas.mpl_disconnect(drawid)
33-
#drawid = fig.canvas.mpl_connect('draw_event', start_timer)
29+
# Or could start the timer on first figure draw:
30+
# def start_timer(event):
31+
# timer.start()
32+
# fig.canvas.mpl_disconnect(drawid)
33+
# drawid = fig.canvas.mpl_connect('draw_event', start_timer)
3434

3535
plt.show()

examples/images_contours_and_fields/irregulardatagrid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252

5353
# Note that scipy.interpolate provides means to interpolate data on a grid
5454
# as well. The following would be an alternative to the four lines above:
55-
#from scipy.interpolate import griddata
56-
#zi = griddata((x, y), z, (xi[None, :], yi[:, None]), method='linear')
55+
# from scipy.interpolate import griddata
56+
# zi = griddata((x, y), z, (xi[None, :], yi[:, None]), method='linear')
5757

5858
ax1.contour(xi, yi, zi, levels=14, linewidths=0.5, colors='k')
5959
cntr1 = ax1.contourf(xi, yi, zi, levels=14, cmap="RdBu_r")

examples/images_contours_and_fields/tricontour_smooth_delaunay.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
import numpy as np
3030

3131

32-
#-----------------------------------------------------------------------------
32+
# ----------------------------------------------------------------------------
3333
# Analytical test function
34-
#-----------------------------------------------------------------------------
34+
# ----------------------------------------------------------------------------
3535
def experiment_res(x, y):
3636
"""An analytic function representing experiment results."""
3737
x = 2 * x
@@ -44,9 +44,9 @@ def experiment_res(x, y):
4444
2 * (x**2 + y**2))
4545
return (np.max(z) - z) / (np.max(z) - np.min(z))
4646

47-
#-----------------------------------------------------------------------------
47+
# ----------------------------------------------------------------------------
4848
# Generating the initial data test points and triangulation for the demo
49-
#-----------------------------------------------------------------------------
49+
# ----------------------------------------------------------------------------
5050
# User parameters for data test points
5151

5252
# Number of test data points, tested from 3 to 5000 for subdiv=3
@@ -83,9 +83,9 @@ def experiment_res(x, y):
8383
tri.set_mask(mask_init)
8484

8585

86-
#-----------------------------------------------------------------------------
86+
# ----------------------------------------------------------------------------
8787
# Improving the triangulation before high-res plots: removing flat triangles
88-
#-----------------------------------------------------------------------------
88+
# ----------------------------------------------------------------------------
8989
# masking badly shaped triangles at the border of the triangular mesh.
9090
mask = TriAnalyzer(tri).get_flat_tri_mask(min_circle_ratio)
9191
tri.set_mask(mask)
@@ -102,9 +102,9 @@ def experiment_res(x, y):
102102
flat_tri.set_mask(~mask)
103103

104104

105-
#-----------------------------------------------------------------------------
105+
# ----------------------------------------------------------------------------
106106
# Now the plots
107-
#-----------------------------------------------------------------------------
107+
# ----------------------------------------------------------------------------
108108
# User options for plots
109109
plot_tri = True # plot of base triangulation
110110
plot_masked_tri = True # plot of excessively flat excluded triangles

examples/images_contours_and_fields/tricontour_smooth_user.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import numpy as np
1313

1414

15-
#-----------------------------------------------------------------------------
15+
# ----------------------------------------------------------------------------
1616
# Analytical test function
17-
#-----------------------------------------------------------------------------
17+
# ----------------------------------------------------------------------------
1818
def function_z(x, y):
1919
r1 = np.sqrt((0.5 - x)**2 + (0.5 - y)**2)
2020
theta1 = np.arctan2(0.5 - x, 0.5 - y)
@@ -25,9 +25,9 @@ def function_z(x, y):
2525
0.7 * (x**2 + y**2))
2626
return (np.max(z) - z) / (np.max(z) - np.min(z))
2727

28-
#-----------------------------------------------------------------------------
28+
# ----------------------------------------------------------------------------
2929
# Creating a Triangulation
30-
#-----------------------------------------------------------------------------
30+
# ----------------------------------------------------------------------------
3131
# First create the x and y coordinates of the points.
3232
n_angles = 20
3333
n_radii = 10
@@ -52,15 +52,15 @@ def function_z(x, y):
5252
y[triang.triangles].mean(axis=1))
5353
< min_radius)
5454

55-
#-----------------------------------------------------------------------------
55+
# ----------------------------------------------------------------------------
5656
# Refine data
57-
#-----------------------------------------------------------------------------
57+
# ----------------------------------------------------------------------------
5858
refiner = tri.UniformTriRefiner(triang)
5959
tri_refi, z_test_refi = refiner.refine_field(z, subdiv=3)
6060

61-
#-----------------------------------------------------------------------------
61+
# ----------------------------------------------------------------------------
6262
# Plot the triangulation and the high-res iso-contours
63-
#-----------------------------------------------------------------------------
63+
# ----------------------------------------------------------------------------
6464
fig, ax = plt.subplots()
6565
ax.set_aspect('equal')
6666
ax.triplot(triang, lw=0.5, color='white')

examples/images_contours_and_fields/trigradient_demo.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import numpy as np
1414

1515

16-
#-----------------------------------------------------------------------------
16+
# ----------------------------------------------------------------------------
1717
# Electrical potential of a dipole
18-
#-----------------------------------------------------------------------------
18+
# ----------------------------------------------------------------------------
1919
def dipole_potential(x, y):
2020
"""The electric dipole potential V, at position *x*, *y*."""
2121
r_sq = x**2 + y**2
@@ -24,9 +24,9 @@ def dipole_potential(x, y):
2424
return (np.max(z) - z) / (np.max(z) - np.min(z))
2525

2626

27-
#-----------------------------------------------------------------------------
27+
# ----------------------------------------------------------------------------
2828
# Creating a Triangulation
29-
#-----------------------------------------------------------------------------
29+
# ----------------------------------------------------------------------------
3030
# First create the x and y coordinates of the points.
3131
n_angles = 30
3232
n_radii = 10
@@ -50,23 +50,23 @@ def dipole_potential(x, y):
5050
y[triang.triangles].mean(axis=1))
5151
< min_radius)
5252

53-
#-----------------------------------------------------------------------------
53+
# ----------------------------------------------------------------------------
5454
# Refine data - interpolates the electrical potential V
55-
#-----------------------------------------------------------------------------
55+
# ----------------------------------------------------------------------------
5656
refiner = UniformTriRefiner(triang)
5757
tri_refi, z_test_refi = refiner.refine_field(V, subdiv=3)
5858

59-
#-----------------------------------------------------------------------------
59+
# ----------------------------------------------------------------------------
6060
# Computes the electrical field (Ex, Ey) as gradient of electrical potential
61-
#-----------------------------------------------------------------------------
61+
# ----------------------------------------------------------------------------
6262
tci = CubicTriInterpolator(triang, -V)
6363
# Gradient requested here at the mesh nodes but could be anywhere else:
6464
(Ex, Ey) = tci.gradient(triang.x, triang.y)
6565
E_norm = np.sqrt(Ex**2 + Ey**2)
6666

67-
#-----------------------------------------------------------------------------
67+
# ----------------------------------------------------------------------------
6868
# Plot the triangulation, the potential iso-contours and the vector field
69-
#-----------------------------------------------------------------------------
69+
# ----------------------------------------------------------------------------
7070
fig, ax = plt.subplots()
7171
ax.set_aspect('equal')
7272
# Enforce the margins, and enlarge them to give room for the vectors.

examples/mplot3d/subplot3d.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
# set up a figure twice as wide as it is tall
1717
fig = plt.figure(figsize=plt.figaspect(0.5))
1818

19-
#===============
20-
# First subplot
21-
#===============
19+
# =============
20+
# First subplot
21+
# =============
2222
# set up the axes for the first plot
2323
ax = fig.add_subplot(1, 2, 1, projection='3d')
2424

@@ -33,9 +33,9 @@
3333
ax.set_zlim(-1.01, 1.01)
3434
fig.colorbar(surf, shrink=0.5, aspect=10)
3535

36-
#===============
36+
# ==============
3737
# Second subplot
38-
#===============
38+
# ==============
3939
# set up the axes for the second plot
4040
ax = fig.add_subplot(1, 2, 2, projection='3d')
4141

examples/mplot3d/trisurf3d_2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
fig = plt.figure(figsize=plt.figaspect(0.5))
1919

20-
#============
20+
# ==========
2121
# First plot
22-
#============
22+
# ==========
2323

2424
# Make a mesh in the space of parameterisation variables u and v
2525
u = np.linspace(0, 2.0 * np.pi, endpoint=True, num=50)
@@ -43,9 +43,9 @@
4343
ax.set_zlim(-1, 1)
4444

4545

46-
#============
46+
# ===========
4747
# Second plot
48-
#============
48+
# ===========
4949

5050
# Make parameter spaces radii and angles.
5151
n_angles = 36

examples/pie_and_polar_charts/nested_pie.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656

5757
size = 0.3
5858
vals = np.array([[60., 32.], [37., 40.], [29., 10.]])
59-
#normalize vals to 2 pi
59+
# Normalize vals to 2 pi
6060
valsnorm = vals/np.sum(vals)*2*np.pi
61-
#obtain the ordinates of the bar edges
61+
# Obtain the ordinates of the bar edges
6262
valsleft = np.cumsum(np.append(0, valsnorm.flatten()[:-1])).reshape(vals.shape)
6363

6464
cmap = plt.get_cmap("tab20c")

examples/pyplots/whats_new_1_subplot3d.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"""
88

99
from matplotlib import cm
10-
#from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter
1110
import matplotlib.pyplot as plt
1211
import numpy as np
1312

@@ -23,9 +22,6 @@
2322
linewidth=0, antialiased=False)
2423
ax.set_zlim3d(-1.01, 1.01)
2524

26-
#ax.zaxis.set_major_locator(LinearLocator(10))
27-
#ax.zaxis.set_major_formatter(FormatStrFormatter('%.03f'))
28-
2925
fig.colorbar(surf, shrink=0.5, aspect=5)
3026

3127
from mpl_toolkits.mplot3d.axes3d import get_test_data

examples/specialty_plots/topographic_hillshading.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
dem = get_sample_data('jacksboro_fault_dem.npz', np_load=True)
2626
z = dem['elevation']
27-
#-- Optional dx and dy for accurate vertical exaggeration ---------------------
27+
# -- Optional dx and dy for accurate vertical exaggeration --------------------
2828
# If you need topographically accurate vertical exaggeration, or you don't want
2929
# to guess at what *vert_exag* should be, you'll need to specify the cellsize
3030
# of the grid (i.e. the *dx* and *dy* parameters). Otherwise, any *vert_exag*
@@ -36,7 +36,7 @@
3636
dx, dy = dem['dx'], dem['dy']
3737
dy = 111200 * dy
3838
dx = 111200 * dx * np.cos(np.radians(dem['ymin']))
39-
#------------------------------------------------------------------------------
39+
# -----------------------------------------------------------------------------
4040

4141
# Shade from the northwest, with the sun 45 degrees from horizontal
4242
ls = LightSource(azdeg=315, altdeg=45)

examples/text_labels_and_annotations/annotation_demo.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,8 @@
338338
# It is also possible to generate draggable annotations
339339

340340
an1 = ax1.annotate('Drag me 1', xy=(.5, .7), xycoords='data',
341-
#xytext=(.5, .7), textcoords='data',
342341
ha="center", va="center",
343-
bbox=bbox_args,
344-
#arrowprops=arrow_args
345-
)
342+
bbox=bbox_args)
346343

347344
an2 = ax1.annotate('Drag me 2', xy=(.5, .5), xycoords=an1,
348345
xytext=(.5, .3), textcoords='axes fraction',

examples/text_labels_and_annotations/line_with_text.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def draw(self, renderer):
5555
fig, ax = plt.subplots()
5656
x, y = np.random.rand(2, 20)
5757
line = MyLine(x, y, mfc='red', ms=12, label='line label')
58-
#line.text.set_text('line label')
5958
line.text.set_color('red')
6059
line.text.set_fontsize(16)
6160

examples/user_interfaces/embedding_in_wx2_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def add_toolbar(self):
4747
self.toolbar.update()
4848

4949

50-
# alternatively you could use
51-
#class App(wx.App):
50+
# Alternatively you could use:
51+
# class App(wx.App):
5252
class App(WIT.InspectableApp):
5353
def OnInit(self):
5454
"""Create the main window and insert the custom frame."""

examples/user_interfaces/embedding_in_wx5_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def add(self, name="plot"):
4444

4545

4646
def demo():
47-
# alternatively you could use
48-
#app = wx.App()
47+
# Alternatively you could use:
48+
# app = wx.App()
4949
# InspectableApp is a great debug tool, see:
5050
# http://wiki.wxpython.org/Widget%20Inspection%20Tool
5151
app = wit.InspectableApp()

0 commit comments

Comments
 (0)