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

Skip to content

Commit c3207eb

Browse files
committed
Minor whitespace edits
1 parent be4667a commit c3207eb

16 files changed

+48
-10
lines changed

examples/animation/basic_example.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def update_line(num, data, line):
1717
return line,
1818

1919
###############################################################################
20+
2021
fig1 = plt.figure()
2122

2223
# Fixing random state for reproducibility
@@ -34,6 +35,7 @@ def update_line(num, data, line):
3435
# To save the animation, use the command: line_ani.save('lines.mp4')
3536

3637
###############################################################################
38+
3739
fig2 = plt.figure()
3840

3941
x = np.arange(-9, 10)

examples/api/sankey_basics.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
# Example 1 -- Mostly defaults
1616
# This demonstrates how to create a simple diagram by implicitly calling the
1717
# Sankey.add() method and by appending finish() to the call to the class.
18+
1819
Sankey(flows=[0.25, 0.15, 0.60, -0.20, -0.15, -0.05, -0.50, -0.10],
1920
labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', 'Fifth'],
2021
orientations=[-1, 1, 0, 1, 1, 1, 0, -1]).finish()
2122
plt.title("The default settings produce a diagram like this.")
23+
2224
###############################################################################
2325
# Notice:
2426
# 1. Axes weren't provided when Sankey() was instantiated, so they were
@@ -39,6 +41,7 @@
3941
# 7. Formatting the numbers in the path labels and the associated unit
4042
# 8. Changing the appearance of the patch and the labels after the figure is
4143
# created
44+
4245
fig = plt.figure()
4346
ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[],
4447
title="Flow Diagram of a Widget")
@@ -54,6 +57,7 @@
5457
diagrams = sankey.finish()
5558
diagrams[0].texts[-1].set_color('r')
5659
diagrams[0].text.set_fontweight('bold')
60+
5761
###############################################################################
5862
# Notice:
5963
# 1. Since the sum of the flows is nonzero, the width of the trunk isn't
@@ -68,6 +72,7 @@
6872
# 1. Connecting two systems
6973
# 2. Turning off the labels of the quantities
7074
# 3. Adding a legend
75+
7176
fig = plt.figure()
7277
ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Two Systems")
7378
flows = [0.25, 0.15, 0.60, -0.10, -0.05, -0.25, -0.15, -0.10, -0.35]
@@ -79,6 +84,7 @@
7984
diagrams = sankey.finish()
8085
diagrams[-1].patch.set_hatch('/')
8186
plt.legend(loc='best')
87+
8288
###############################################################################
8389
# Notice that only one connection is specified, but the systems form a
8490
# circuit since: (1) the lengths of the paths are justified and (2) the

examples/images_contours_and_fields/contour_demo.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# inline argument to clabel will control whether the labels are draw
3232
# over the line segments of the contour, removing the lines beneath
3333
# the label
34+
3435
plt.figure()
3536
CS = plt.contour(X, Y, Z)
3637
plt.clabel(CS, inline=1, fontsize=10)
@@ -41,6 +42,7 @@
4142
# contour labels can be placed manually by providing list of positions
4243
# (in data coordinate). See ginput_manual_clabel.py for interactive
4344
# placement.
45+
4446
plt.figure()
4547
CS = plt.contour(X, Y, Z)
4648
manual_locations = [(-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)]
@@ -50,6 +52,7 @@
5052

5153
###############################################################################
5254
# You can force all the contours to be the same color.
55+
5356
plt.figure()
5457
CS = plt.contour(X, Y, Z, 6,
5558
colors='k', # negative contours will be dashed by default
@@ -59,6 +62,7 @@
5962

6063
###############################################################################
6164
# You can set negative contours to be solid instead of dashed:
65+
6266
matplotlib.rcParams['contour.negative_linestyle'] = 'solid'
6367
plt.figure()
6468
CS = plt.contour(X, Y, Z, 6,
@@ -70,6 +74,7 @@
7074

7175
###############################################################################
7276
# And you can manually specify the colors of the contour
77+
7378
plt.figure()
7479
CS = plt.contour(X, Y, Z, 6,
7580
linewidths=np.arange(.5, 4, .5),
@@ -82,6 +87,7 @@
8287
###############################################################################
8388
# Or you can use a colormap to specify the colors; the default
8489
# colormap will be used for the contour lines
90+
8591
plt.figure()
8692
im = plt.imshow(Z, interpolation='bilinear', origin='lower',
8793
cmap=cm.gray, extent=(-3, 3, -2, 2))

examples/images_contours_and_fields/contour_label_demo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
###############################################################################
2222
# Define our surface
23+
2324
delta = 0.025
2425
x = np.arange(-3.0, 3.0, delta)
2526
y = np.arange(-2.0, 2.0, delta)
@@ -32,6 +33,7 @@
3233
###############################################################################
3334
# Make contour labels using creative float classes
3435
# Follows suggestion of Manuel Metz
36+
3537
plt.figure()
3638

3739
# Basic contour plot
@@ -60,8 +62,8 @@ def __repr__(self):
6062
plt.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10)
6163

6264
###############################################################################
63-
# Label contours with arbitrary strings using a
64-
# dictionary
65+
# Label contours with arbitrary strings using a dictionary
66+
6567
plt.figure()
6668

6769
# Basic contour plot

examples/images_contours_and_fields/contourf_hatching.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
x, y = x.flatten(), y.flatten()
1919

2020
###############################################################################
21-
# ---------------------------------------------
22-
# | Plot #1 |
23-
# ---------------------------------------------
24-
# the simplest hatched plot with a colorbar
21+
# Plot 1: the simplest hatched plot with a colorbar
22+
2523
fig = plt.figure()
2624
cs = plt.contourf(x, y, z, hatches=['-', '/', '\\', '//'],
2725
cmap=plt.get_cmap('gray'),
@@ -30,10 +28,8 @@
3028
plt.colorbar()
3129

3230
###############################################################################
33-
# ---------------------------------------------
34-
# | Plot #2 |
35-
# ---------------------------------------------
36-
# a plot of hatches without color with a legend
31+
# Plot 2: a plot of hatches without color with a legend
32+
3733
plt.figure()
3834
n_levels = 6
3935
plt.contour(x, y, z, n_levels, colors='black', linestyles='-')

examples/images_contours_and_fields/quiver_demo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
V = np.sin(Y)
1818

1919
###############################################################################
20+
2021
plt.figure()
2122
plt.title('Arrows scale with plot width, not view')
2223
Q = plt.quiver(X, Y, U, V, units='width')
2324
qk = plt.quiverkey(Q, 0.9, 0.9, 2, r'$2 \frac{m}{s}$', labelpos='E',
2425
coordinates='figure')
2526

2627
###############################################################################
28+
2729
plt.figure()
2830
plt.title("pivot='mid'; every third arrow; units='inches'")
2931
Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
@@ -33,6 +35,7 @@
3335
plt.scatter(X[::3, ::3], Y[::3, ::3], color='r', s=5)
3436

3537
###############################################################################
38+
3639
plt.figure()
3740
plt.title("pivot='tip'; scales with x view")
3841
M = np.hypot(U, V)

examples/images_contours_and_fields/tricontour_demo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
###############################################################################
4141
# pcolor plot.
42+
4243
plt.figure()
4344
plt.gca().set_aspect('equal')
4445
plt.tricontourf(triang, z)
@@ -101,6 +102,7 @@
101102
# arrays to tripcolor directly. It would be better to use a Triangulation
102103
# object if the same triangulation was to be used more than once to save
103104
# duplicated calculations.
105+
104106
plt.figure()
105107
plt.gca().set_aspect('equal')
106108
plt.tricontourf(x, y, triangles, z)

examples/images_contours_and_fields/tripcolor_demo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
###############################################################################
4141
# tripcolor plot.
42+
4243
plt.figure()
4344
plt.gca().set_aspect('equal')
4445
plt.tripcolor(triang, z, shading='flat')
@@ -47,6 +48,7 @@
4748

4849
###############################################################################
4950
# Illustrate Gouraud shading.
51+
5052
plt.figure()
5153
plt.gca().set_aspect('equal')
5254
plt.tripcolor(triang, z, shading='gouraud')
@@ -114,6 +116,7 @@
114116
# duplicated calculations.
115117
# Can specify one color value per face rather than one per point by using the
116118
# facecolors kwarg.
119+
117120
plt.figure()
118121
plt.gca().set_aspect('equal')
119122
plt.tripcolor(x, y, triangles, facecolors=zfaces, edgecolors='k')

examples/images_contours_and_fields/triplot_demo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
###############################################################################
4040
# Plot the triangulation.
41+
4142
plt.figure()
4243
plt.gca().set_aspect('equal')
4344
plt.triplot(triang, 'bo-', lw=1)
@@ -96,6 +97,7 @@
9697
# arrays to triplot directly. It would be better to use a Triangulation object
9798
# if the same triangulation was to be used more than once to save duplicated
9899
# calculations.
100+
99101
plt.figure()
100102
plt.gca().set_aspect('equal')
101103
plt.triplot(x, y, triangles, 'go-', lw=1.0)

examples/pylab_examples/markevery_demo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
###############################################################################
4848
# Plot each markevery case for linear x and y scales
49+
4950
fig1 = plt.figure(num=1, figsize=figsize)
5051
ax = []
5152
for i, case in enumerate(cases):
@@ -58,6 +59,7 @@
5859

5960
###############################################################################
6061
# Plot each markevery case for log x and y scales
62+
6163
fig2 = plt.figure(num=2, figsize=figsize)
6264
axlog = []
6365
for i, case in enumerate(cases):
@@ -75,6 +77,7 @@
7577
# note the behaviour when zoomed in. When a start marker offset is specified
7678
# it is always interpreted with respect to the first data point which might be
7779
# different to the first visible data point.
80+
7881
fig3 = plt.figure(num=3, figsize=figsize)
7982
axzoom = []
8083
for i, case in enumerate(cases):
@@ -93,6 +96,7 @@
9396

9497
###############################################################################
9598
# Plot each markevery case for polar plots
99+
96100
fig4 = plt.figure(num=4, figsize=figsize)
97101
axpolar = []
98102
for i, case in enumerate(cases):

examples/pylab_examples/multiple_figs_demo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
###############################################################################
1616
# Create figure 1
17+
1718
plt.figure(1)
1819
plt.subplot(211)
1920
plt.plot(t, s1)
@@ -22,11 +23,13 @@
2223

2324
###############################################################################
2425
# Create figure 2
26+
2527
plt.figure(2)
2628
plt.plot(t, s2)
2729

2830
###############################################################################
2931
# Now switch back to figure 1 and make some changes
32+
3033
plt.figure(1)
3134
plt.subplot(211)
3235
plt.plot(t, s2, 's')

examples/pylab_examples/spine_placement_demo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
###############################################################################
13+
1314
fig = plt.figure()
1415
x = np.linspace(-np.pi, np.pi, 100)
1516
y = 2*np.sin(x)

examples/pylab_examples/zorder_demo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
###############################################################################
4040
# Lines on top of scatter
41+
4142
plt.figure()
4243
plt.subplot(211)
4344
plt.plot(x, y, 'r', lw=3)
@@ -52,6 +53,7 @@
5253

5354
###############################################################################
5455
# A new figure, with individually ordered items
56+
5557
x = np.linspace(0, 2*np.pi, 100)
5658
plt.figure()
5759
plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', zorder=10) # on top

examples/pyplots/fig_axes_customize_simple.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
###############################################################################
1111
# ``plt.figure`` creates a ```matplotlib.figure.Figure`` instance
12+
1213
fig = plt.figure()
1314
rect = fig.patch # a rectangle instance
1415
rect.set_facecolor('lightgoldenrodyellow')

examples/statistics/boxplot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
###############################################################################
2929
# Demonstrate how to toggle the display of different elements:
30+
3031
fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True)
3132
axes[0, 0].boxplot(data, labels=labels)
3233
axes[0, 0].set_title('Default', fontsize=fs)
@@ -57,6 +58,7 @@
5758

5859
###############################################################################
5960
# Demonstrate how to customize the display different elements:
61+
6062
boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod')
6163
flierprops = dict(marker='o', markerfacecolor='green', markersize=12,
6264
linestyle='none')

examples/statistics/bxp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# After we've computed the stats, we can go through and change anything.
3131
# Just to prove it, I'll set the median of each set to the median of all
3232
# the data, and double the means
33+
3334
for n in range(len(stats)):
3435
stats[n]['med'] = np.median(data)
3536
stats[n]['mean'] *= 2
@@ -40,6 +41,7 @@
4041

4142
###############################################################################
4243
# Demonstrate how to toggle the display of different elements:
44+
4345
fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True)
4446
axes[0, 0].bxp(stats)
4547
axes[0, 0].set_title('Default', fontsize=fs)
@@ -69,6 +71,7 @@
6971

7072
###############################################################################
7173
# Demonstrate how to customize the display different elements:
74+
7275
boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod')
7376
flierprops = dict(marker='o', markerfacecolor='green', markersize=12,
7477
linestyle='none')

0 commit comments

Comments
 (0)