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

Skip to content

Commit c73cbf7

Browse files
authored
Merge pull request #24007 from meeseeksmachine/auto-backport-of-pr-24004-on-v3.6.x
Backport PR #24004 on branch v3.6.x (Increase consistency in tutorials and examples)
2 parents 8f39714 + f5e6927 commit c73cbf7

File tree

11 files changed

+34
-32
lines changed

11 files changed

+34
-32
lines changed

examples/color/color_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
# 3) gray level string:
4949
ax.set_title('Voltage vs. time chart', color='0.7')
5050
# 4) single letter color string
51-
ax.set_xlabel('time (s)', color='c')
51+
ax.set_xlabel('Time [s]', color='c')
5252
# 5) a named color:
53-
ax.set_ylabel('voltage (mV)', color='peachpuff')
53+
ax.set_ylabel('Voltage [mV]', color='peachpuff')
5454
# 6) a named xkcd color:
5555
ax.plot(t, s, 'xkcd:crimson')
5656
# 7) Cn notation:

examples/color/custom_cmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
4343
If, as in this example, there are no discontinuities in the r, g, and b
4444
components, then it is quite simple: the second and third element of
45-
each tuple, above, is the same--call it "``y``". The first element ("``x``")
45+
each tuple, above, is the same -- call it "``y``". The first element ("``x``")
4646
defines interpolation intervals over the full range of 0 to 1, and it
4747
must span that whole range. In other words, the values of ``x`` divide the
4848
0-to-1 range into a set of segments, and ``y`` gives the end-point color

examples/lines_bars_and_markers/cohere.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
nse1 = np.random.randn(len(t)) # white noise 1
1717
nse2 = np.random.randn(len(t)) # white noise 2
1818

19-
# Two signals with a coherent part at 10Hz and a random part
19+
# Two signals with a coherent part at 10 Hz and a random part
2020
s1 = np.sin(2 * np.pi * 10 * t) + nse1
2121
s2 = np.sin(2 * np.pi * 10 * t) + nse2
2222

2323
fig, axs = plt.subplots(2, 1)
2424
axs[0].plot(t, s1, t, s2)
2525
axs[0].set_xlim(0, 2)
26-
axs[0].set_xlabel('time')
26+
axs[0].set_xlabel('Time')
2727
axs[0].set_ylabel('s1 and s2')
2828
axs[0].grid(True)
2929

3030
cxy, f = axs[1].cohere(s1, s2, 256, 1. / dt)
31-
axs[1].set_ylabel('coherence')
31+
axs[1].set_ylabel('Coherence')
3232

3333
fig.tight_layout()
3434
plt.show()

examples/lines_bars_and_markers/csd_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
ax1.plot(t, s1, t, s2)
3535
ax1.set_xlim(0, 5)
36-
ax1.set_xlabel('time')
36+
ax1.set_xlabel('Time')
3737
ax1.set_ylabel('s1 and s2')
3838
ax1.grid(True)
3939

examples/pyplots/fig_axes_labels_simple.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
fig = plt.figure()
1212
fig.subplots_adjust(top=0.8)
1313
ax1 = fig.add_subplot(211)
14-
ax1.set_ylabel('volts')
15-
ax1.set_title('a sine wave')
14+
ax1.set_ylabel('Voltage [V]')
15+
ax1.set_title('A sine wave')
1616

1717
t = np.arange(0.0, 1.0, 0.01)
1818
s = np.sin(2 * np.pi * t)
@@ -23,7 +23,7 @@
2323

2424
ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
2525
n, bins, patches = ax2.hist(np.random.randn(1000), 50)
26-
ax2.set_xlabel('time (s)')
26+
ax2.set_xlabel('Time [s]')
2727

2828
plt.show()
2929

examples/pyplots/pyplot_mathtext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20)
1717
plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$',
1818
fontsize=20)
19-
plt.xlabel('time (s)')
20-
plt.ylabel('volts (mV)')
19+
plt.xlabel('Time [s]')
20+
plt.ylabel('Voltage [mV]')
2121
plt.show()
2222

2323
#############################################################################

tutorials/advanced/path_tutorial.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
# ==============
7777
#
7878
# Some of the path components require multiple vertices to specify them:
79-
# for example CURVE 3 is a `bézier
79+
# for example CURVE 3 is a `Bézier
8080
# <https://en.wikipedia.org/wiki/B%C3%A9zier_curve>`_ curve with one
8181
# control point and one end point, and CURVE4 has three vertices for the
8282
# two control points and the end point. The example below shows a
83-
# CURVE4 Bézier spline -- the bézier curve will be contained in the
83+
# CURVE4 Bézier spline -- the Bézier curve will be contained in the
8484
# convex hull of the start point, the two control points, and the end
8585
# point
8686

@@ -139,8 +139,8 @@
139139
# for each histogram bar: the rectangle width is the bin width and the
140140
# rectangle height is the number of datapoints in that bin. First we'll
141141
# create some random normally distributed data and compute the
142-
# histogram. Because numpy returns the bin edges and not centers, the
143-
# length of ``bins`` is 1 greater than the length of ``n`` in the
142+
# histogram. Because NumPy returns the bin edges and not centers, the
143+
# length of ``bins`` is one greater than the length of ``n`` in the
144144
# example below::
145145
#
146146
# # histogram our data with numpy
@@ -159,10 +159,10 @@
159159
#
160160
# Now we have to construct our compound path, which will consist of a
161161
# series of ``MOVETO``, ``LINETO`` and ``CLOSEPOLY`` for each rectangle.
162-
# For each rectangle, we need 5 vertices: 1 for the ``MOVETO``, 3 for
163-
# the ``LINETO``, and 1 for the ``CLOSEPOLY``. As indicated in the
164-
# table above, the vertex for the closepoly is ignored but we still need
165-
# it to keep the codes aligned with the vertices::
162+
# For each rectangle, we need five vertices: one for the ``MOVETO``,
163+
# three for the ``LINETO``, and one for the ``CLOSEPOLY``. As indicated
164+
# in the table above, the vertex for the closepoly is ignored but we still
165+
# need it to keep the codes aligned with the vertices::
166166
#
167167
# nverts = nrects*(1+3+1)
168168
# verts = np.zeros((nverts, 2))

tutorials/intermediate/artists.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ class in the Matplotlib API, and the one you will be working with most
123123
fig = plt.figure()
124124
fig.subplots_adjust(top=0.8)
125125
ax1 = fig.add_subplot(211)
126-
ax1.set_ylabel('volts')
127-
ax1.set_title('a sine wave')
126+
ax1.set_ylabel('Voltage [V]')
127+
ax1.set_title('A sine wave')
128128

129129
t = np.arange(0.0, 1.0, 0.01)
130130
s = np.sin(2*np.pi*t)
@@ -136,7 +136,7 @@ class in the Matplotlib API, and the one you will be working with most
136136
ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
137137
n, bins, patches = ax2.hist(np.random.randn(1000), 50,
138138
facecolor='yellow', edgecolor='yellow')
139-
ax2.set_xlabel('time (s)')
139+
ax2.set_xlabel('Time [s]')
140140

141141
plt.show()
142142

tutorials/intermediate/constrainedlayout_guide.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def example_plot(ax, fontsize=12, hide_labels=False):
263263

264264
##########################################
265265
# If there are more than two columns, the *wspace* is shared between them,
266-
# so here the wspace is divided in 2, with a *wspace* of 0.1 between each
266+
# so here the wspace is divided in two, with a *wspace* of 0.1 between each
267267
# column:
268268

269269
fig, axs = plt.subplots(2, 3, layout="constrained")

tutorials/introductory/pyplot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,10 @@ def f(t):
295295
# plt.figure(2) # a second figure
296296
# plt.plot([4, 5, 6]) # creates a subplot() by default
297297
#
298-
# plt.figure(1) # figure 1 current; subplot(212) still current
299-
# plt.subplot(211) # make subplot(211) in figure1 current
298+
# plt.figure(1) # first figure current;
299+
# # subplot(212) still current
300+
# plt.subplot(211) # make subplot(211) in the first figure
301+
# # current
300302
# plt.title('Easy as 1, 2, 3') # subplot 211 title
301303
#
302304
# You can clear the current figure with `~.pyplot.clf`

tutorials/text/text_intro.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
fig, ax = plt.subplots(figsize=(5, 3))
119119
fig.subplots_adjust(bottom=0.15, left=0.2)
120120
ax.plot(x1, y1)
121-
ax.set_xlabel('time [s]')
121+
ax.set_xlabel('Time [s]')
122122
ax.set_ylabel('Damped oscillation [V]')
123123

124124
plt.show()
@@ -131,7 +131,7 @@
131131
fig, ax = plt.subplots(figsize=(5, 3))
132132
fig.subplots_adjust(bottom=0.15, left=0.2)
133133
ax.plot(x1, y1*10000)
134-
ax.set_xlabel('time [s]')
134+
ax.set_xlabel('Time [s]')
135135
ax.set_ylabel('Damped oscillation [V]')
136136

137137
plt.show()
@@ -144,7 +144,7 @@
144144
fig, ax = plt.subplots(figsize=(5, 3))
145145
fig.subplots_adjust(bottom=0.15, left=0.2)
146146
ax.plot(x1, y1*10000)
147-
ax.set_xlabel('time [s]')
147+
ax.set_xlabel('Time [s]')
148148
ax.set_ylabel('Damped oscillation [V]', labelpad=18)
149149

150150
plt.show()
@@ -159,7 +159,7 @@
159159
fig, ax = plt.subplots(figsize=(5, 3))
160160
fig.subplots_adjust(bottom=0.15, left=0.2)
161161
ax.plot(x1, y1)
162-
ax.set_xlabel('time [s]', position=(0., 1e6), horizontalalignment='left')
162+
ax.set_xlabel('Time [s]', position=(0., 1e6), horizontalalignment='left')
163163
ax.set_ylabel('Damped oscillation [V]')
164164

165165
plt.show()
@@ -179,7 +179,7 @@
179179
fig, ax = plt.subplots(figsize=(5, 3))
180180
fig.subplots_adjust(bottom=0.15, left=0.2)
181181
ax.plot(x1, y1)
182-
ax.set_xlabel('time [s]', fontsize='large', fontweight='bold')
182+
ax.set_xlabel('Time [s]', fontsize='large', fontweight='bold')
183183
ax.set_ylabel('Damped oscillation [V]', fontproperties=font)
184184

185185
plt.show()
@@ -191,7 +191,7 @@
191191
fig, ax = plt.subplots(figsize=(5, 3))
192192
fig.subplots_adjust(bottom=0.2, left=0.2)
193193
ax.plot(x1, np.cumsum(y1**2))
194-
ax.set_xlabel('time [s] \n This was a long experiment')
194+
ax.set_xlabel('Time [s] \n This was a long experiment')
195195
ax.set_ylabel(r'$\int\ Y^2\ dt\ \ [V^2 s]$')
196196
plt.show()
197197

0 commit comments

Comments
 (0)