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

Skip to content

Commit 657cee9

Browse files
committed
Clean up E265 in examples.
1 parent bc97294 commit 657cee9

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

0 commit comments

Comments
 (0)