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

Skip to content

Commit fc020b3

Browse files
authored
Merge pull request matplotlib#149 from QuLogic/minor-typos
Fix minor typos
2 parents 05d47a5 + 1b461e7 commit fc020b3

File tree

5 files changed

+80
-74
lines changed

5 files changed

+80
-74
lines changed

cheatsheets.tex

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,13 @@
301301
% --- Layout ---------------------------------------------------------------
302302
\begin{myboxed}{Subplots layout \hfill
303303
\API{https://matplotlib.org/tutorials/intermediate/gridspec.html} }
304-
\plot{layout-subplot.pdf}{\textbf{subplot[s]}(rows,cols,…)}
304+
\plot{layout-subplot.pdf}{\textbf{subplot[s]}(rows, cols, …)}
305305
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplots.html}
306306
{\ttfamily fig, axs = plt.subplots(3, 3)}
307307
{}
308-
\plot{layout-gridspec.pdf}{G = \textbf{gridspec}(rows,cols,…)}
308+
\plot{layout-gridspec.pdf}{G = \textbf{gridspec}(rows,cols, …)}
309309
{https://matplotlib.org/stable/api/_as_gen/matplotlib.gridspec.GridSpec.html}
310-
{\ttfamily ax = G[0,:]}{}
310+
{\ttfamily ax = G[0, :]}{}
311311
\plot{layout-inset.pdf}{ax.\textbf{inset\_axes}(extent)}
312312
{https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.inset_axes.html}
313313
{}{}
@@ -338,7 +338,7 @@
338338

339339
% --- Basic plots -----------------------------------------------------------
340340
\begin{myboxed}{Basic plots}
341-
\plot{basic-plot.pdf}{\textbf{plot}([X],Y,[fmt],…)}
341+
\plot{basic-plot.pdf}{\textbf{plot}([X], Y, [fmt], …)}
342342
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html}
343343
{\optional{X},
344344
\mandatory{Y},
@@ -347,7 +347,7 @@
347347
\optional{marker},
348348
\optional{linestyle}}
349349
{}
350-
\plot{basic-scatter.pdf}{\textbf{scatter}(X,Y,…)}
350+
\plot{basic-scatter.pdf}{\textbf{scatter}(X, Y, …)}
351351
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html}
352352
{\mandatory{X},
353353
\mandatory{Y},
@@ -356,23 +356,23 @@
356356
\optional{marker},
357357
\optional{cmap}}
358358
{}
359-
\plot{basic-bar.pdf}{\textbf{bar[h]}(x,height,…)}
359+
\plot{basic-bar.pdf}{\textbf{bar[h]}(x, height, …)}
360360
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.bar.html}
361361
{ \mandatory{x},
362362
\mandatory{height},
363363
\optional{width},
364364
\optional{bottom},
365365
\optional{align},
366366
\optional{color} }{}
367-
\plot{basic-imshow.pdf}{\textbf{imshow}(Z,…)}
367+
\plot{basic-imshow.pdf}{\textbf{imshow}(Z, …)}
368368
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html}
369369
{ \mandatory{Z},
370370
\optional{cmap},
371371
\optional{interpolation},
372372
\optional{extent},
373373
\optional{origin} }
374374
{}
375-
\plot{basic-contour.pdf}{\textbf{contour[f]}([X],[Y],Z,…)}
375+
\plot{basic-contour.pdf}{\textbf{contour[f]}([X], [Y], Z, …)}
376376
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.contour.html}
377377
{ \optional{X},
378378
\optional{Y},
@@ -382,7 +382,7 @@
382382
\optional{extent},
383383
\optional{origin} }
384384
{}
385-
\plot{basic-pcolormesh.pdf}{\textbf{pcolormesh}([X],[Y],Z,…)}
385+
\plot{basic-pcolormesh.pdf}{\textbf{pcolormesh}([X], [Y], Z, …)}
386386
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pcolormesh.html}
387387
{ \optional{X},
388388
\optional{Y},
@@ -391,7 +391,7 @@
391391
\optional{vmax},
392392
\optional{cmap}}
393393
{}
394-
\plot{basic-quiver.pdf}{\textbf{quiver}([X],[Y],U,V,…)}
394+
\plot{basic-quiver.pdf}{\textbf{quiver}([X], [Y], U, V, …)}
395395
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.quiver.html}
396396
{ \optional{X},
397397
\optional{Y},
@@ -401,15 +401,15 @@
401401
\optional{units},
402402
\optional{angles} }
403403
{}
404-
\plot{basic-pie.pdf}{\textbf{pie}(X,…)}
404+
\plot{basic-pie.pdf}{\textbf{pie}(X, …)}
405405
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pie.html}
406406
{\mandatory{Z},
407407
\optional{explode},
408408
\optional{labels},
409409
\optional{colors},
410410
\optional{radius}}
411411
{}
412-
\plot{basic-text.pdf}{\textbf{text}(x,y,text,…)}
412+
\plot{basic-text.pdf}{\textbf{text}(x, y, text, …)}
413413
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.text.html}
414414
{\mandatory{x},
415415
\mandatory{y},
@@ -432,7 +432,7 @@
432432
\vspace{\fill}
433433
% --- Advanced plots --------------------------------------------------------
434434
\begin{myboxed}{Advanced plots}
435-
\plot{advanced-step.pdf}{\textbf{step}(X,Y,[fmt],…)}
435+
\plot{advanced-step.pdf}{\textbf{step}(X, Y, [fmt], …)}
436436
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.step.html}
437437
{\mandatory{X},
438438
\mandatory{Y},
@@ -441,15 +441,15 @@
441441
\optional{marker},
442442
\optional{where} }
443443
{}
444-
\plot{advanced-boxplot.pdf}{\textbf{boxplot}(X,…)}
444+
\plot{advanced-boxplot.pdf}{\textbf{boxplot}(X, …)}
445445
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.boxplot.html}
446446
{ \mandatory{X},
447447
\optional{notch},
448448
\optional{sym},
449449
\optional{bootstrap},
450450
\optional{widths} }
451451
{}
452-
\plot{advanced-errorbar.pdf}{\textbf{errorbar}(X,Y,xerr,yerr,…)}
452+
\plot{advanced-errorbar.pdf}{\textbf{errorbar}(X,Y,xerr,yerr, …)}
453453
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.errorbar.html}
454454
{ \mandatory{X},
455455
\mandatory{Y},
@@ -465,14 +465,14 @@
465465
\optional{density},
466466
\optional{weights}}
467467
{}
468-
\plot{advanced-violin.pdf}{\textbf{violinplot}(D,…)}
468+
\plot{advanced-violin.pdf}{\textbf{violinplot}(D, …)}
469469
{https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.violinplot.html}
470470
{\mandatory{D},
471471
\optional{positions},
472472
\optional{widths},
473473
\optional{vert} }
474474
{}
475-
\plot{advanced-barbs.pdf}{\textbf{barbs}([X],[Y], U, V, …)}
475+
\plot{advanced-barbs.pdf}{\textbf{barbs}([X], [Y], U, V, …)}
476476
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.barbs.html}
477477
{ \optional{X},
478478
\optional{Y},
@@ -483,13 +483,13 @@
483483
\optional{pivot},
484484
\optional{sizes} }
485485
{}
486-
\plot{advanced-event.pdf}{\textbf{eventplot}(positions,…)}
486+
\plot{advanced-event.pdf}{\textbf{eventplot}(positions, …)}
487487
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.eventplot.html}
488488
{\mandatory{positions},
489489
\optional{orientation},
490490
\optional{lineoffsets} }
491491
{}
492-
\plot{advanced-hexbin.pdf}{\textbf{hexbin}(X,Y,C,…)}
492+
\plot{advanced-hexbin.pdf}{\textbf{hexbin}(X, Y, C, …)}
493493
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hexbin.html}
494494
{\mandatory{X},
495495
\mandatory{Y},
@@ -503,7 +503,7 @@
503503
% --- Scale ---------------------------------------------------------------
504504
\begin{myboxed}{Scales \hfill
505505
\API{https://matplotlib.org/stable/api/scale_api.html}}
506-
{\ttfamily ax.\textbf{set\_[xy]scale}(scale,…)}
506+
{\ttfamily ax.\textbf{set\_[xy]scale}(scale, …)}
507507
\smallskip
508508
\scale{scale-linear.pdf}{\textbf{linear}}{any values}
509509
\scale{scale-log.pdf}{\textbf{log}}{values > 0}
@@ -516,7 +516,7 @@
516516
% --- Projections -----------------------------------------------------------
517517
\begin{myboxed}{Projections \hfill
518518
\API{https://matplotlib.org/stable/api/projections_api.html}}
519-
{\ttfamily \textbf{subplot}(…,projection=p)}
519+
{\ttfamily \textbf{subplot}(…, projection=p)}
520520
\smallskip
521521
\scale{projection-polar.pdf}{p='polar'}{}
522522
\scale{projection-3d.pdf}
@@ -906,7 +906,7 @@
906906

907907
\begin{myboxed}{Legend placement}
908908
\includegraphics[width=\columnwidth]{legend-placement.pdf}
909-
ax.\textbf{legend}(loc="string", bbox\_to\_anchor=(x,y))\\
909+
ax.\textbf{legend}(loc="string", bbox\_to\_anchor=(x, y))\\
910910
\begin{tabular}{@{}p{0.33\columnwidth}
911911
p{0.33\columnwidth}
912912
p{0.33\columnwidth}@{}}
@@ -919,12 +919,12 @@
919919
\begin{tabular}{@{}p{0.495\columnwidth}
920920
p{0.495\columnwidth}@{}}
921921
\scriptsize \rule{0pt}{1.25em}\noindent
922-
\tiny A: upper right / {\ttfamily (-0.1,0.9)} & \tiny B: center right / {\ttfamily (-0.1,0.5)}\\
923-
\tiny C: lower right / {\ttfamily (-0.1,0.1)} & \tiny D: upper left / {\ttfamily (0.1,-0.1)}\\
924-
\tiny E: upper center / {\ttfamily (0.5,-0.1)} & \tiny F: upper right / {\ttfamily (0.9,-0.1)}\\
925-
\tiny G: lower left / {\ttfamily (1.1,0.1)} & \tiny H: center left / {\ttfamily (1.1,0.5)}\\
926-
\tiny I: upper left / {\ttfamily (1.1,0.9)} & \tiny J: lower right / {\ttfamily (0.9,1.1)}\\
927-
\tiny K: lower center / {\ttfamily (0.5,1.1)} & \tiny L: lower left / {\ttfamily (0.1,1.1)}
922+
\tiny A: upper right / {\ttfamily (-0.1, 0.9)} & \tiny B: center right / {\ttfamily (-0.1, 0.5)}\\
923+
\tiny C: lower right / {\ttfamily (-0.1, 0.1)} & \tiny D: upper left / {\ttfamily (0.1, -0.1)}\\
924+
\tiny E: upper center / {\ttfamily (0.5, -0.1)} & \tiny F: upper right / {\ttfamily (0.9, -0.1)}\\
925+
\tiny G: lower left / {\ttfamily (1.1, 0.1)} & \tiny H: center left / {\ttfamily (1.1, 0.5)}\\
926+
\tiny I: upper left / {\ttfamily (1.1, 0.9)} & \tiny J: lower right / {\ttfamily (0.9, 1.1)}\\
927+
\tiny K: lower center / {\ttfamily (0.5, 1.1)} & \tiny L: lower left / {\ttfamily (0.1, 1.1)}
928928
\end{tabular}
929929
\end{myboxed}
930930
%
@@ -1000,12 +1000,12 @@
10001000
plot(X, Y, marker="o", ls="") \hfill fast%
10011001
\vskip.5\baselineskip
10021002
%
1003-
\textcolor{red}{for i in range(n): plot(X[i]) \hfill slow}\\
1004-
plot(sum([x+[None] for x in X],[])) \hfill fast%
1003+
\textcolor{red}{for i in range(n): plot(i, X[i], "o") \hfill slow}\\
1004+
plot(X, marker="o", ls="") \hfill fast%
10051005
\vskip.5\baselineskip
10061006
%
1007-
\textcolor{red}{cla(), imshow(…), canvas.draw() \hfill slow}\\
1008-
im.set\_data(…), canvas.draw() \hfill fast%
1007+
\textcolor{red}{cla(); imshow(…); canvas.draw() \hfill slow}\\
1008+
im.set\_data(…); canvas.draw() \hfill fast%
10091009
\vskip.1\baselineskip
10101010
}
10111011
\end{myboxed}

handout-beginner.tex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ \section*{\LARGE \rmfamily
8383
%
8484
\fbox{2} \textbf{Prepare}
8585
\begin{lstlisting}
86-
X = np.linspace(0, 4*np.pi, 1000)
86+
X = np.linspace(0, 10*np.pi, 1000)
8787
Y = np.sin(X)
8888
\end{lstlisting}
8989
%
@@ -123,7 +123,7 @@ \subsection*{\rmfamily Choose}
123123
% -----------------------------------------------------------------------------
124124
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
125125
\begin{lstlisting}[belowskip=-\baselineskip]
126-
Z = np.random.uniform(0, 1, (8,8))
126+
Z = np.random.uniform(0, 1, (8, 8))
127127

128128
ax.imshow(Z)
129129
\end{lstlisting}
@@ -132,7 +132,7 @@ \subsection*{\rmfamily Choose}
132132
% -----------------------------------------------------------------------------
133133
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
134134
\begin{lstlisting}[belowskip=-\baselineskip]
135-
Z = np.random.uniform(0, 1, (8,8))
135+
Z = np.random.uniform(0, 1, (8, 8))
136136

137137
ax.contourf(Z)
138138
\end{lstlisting}
@@ -168,7 +168,7 @@ \subsection*{\rmfamily Choose}
168168
% -----------------------------------------------------------------------------
169169
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
170170
\begin{lstlisting}[belowskip=-\baselineskip]
171-
Z = np.random.normal(0, 1, (100,3))
171+
Z = np.random.normal(0, 1, (100, 3))
172172

173173
ax.boxplot(Z)
174174
\end{lstlisting}
@@ -225,8 +225,8 @@ \subsection*{\rmfamily Tweak}
225225
\subsection*{\rmfamily Organize}
226226
% -----------------------------------------------------------------------------
227227

228-
You can plot several data on the the same figure, but you can also
229-
split a figure in several subplots (named {\em Axes}): \medskip
228+
You can plot several data on the same figure, but you can also split a figure
229+
in several subplots (named {\em Axes}): \medskip
230230

231231
% -----------------------------------------------------------------------------
232232
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
@@ -240,7 +240,7 @@ \subsection*{\rmfamily Organize}
240240
% -----------------------------------------------------------------------------
241241
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
242242
\begin{lstlisting}[belowskip=-\baselineskip]
243-
fig, (ax1, ax2) = plt.subplots(2,1)
243+
fig, (ax1, ax2) = plt.subplots(2, 1)
244244
ax1.plot(X, Y1, color="C1")
245245
ax2.plot(X, Y2, color="C0")
246246
\end{lstlisting}
@@ -249,7 +249,7 @@ \subsection*{\rmfamily Organize}
249249
% -----------------------------------------------------------------------------
250250
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
251251
\begin{lstlisting}[belowskip=-\baselineskip]
252-
fig, (ax1, ax2) = plt.subplots(1,2)
252+
fig, (ax1, ax2) = plt.subplots(1, 2)
253253
ax1.plot(Y1, X, color="C1")
254254
ax2.plot(Y2, X, color="C0")
255255
\end{lstlisting}

handout-intermediate.tex

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ \subsection*{\rmfamily Figure, axes \& spines}
8383
% -----------------------------------------------------------------------------
8484
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
8585
\begin{lstlisting}[belowskip=-\baselineskip]
86-
fig, axs = plt.subplots(3,3)
87-
axs[0,0].set_facecolor("#ddddff")
88-
axs[2,2].set_facecolor("#ffffdd")
86+
fig, axs = plt.subplots(3, 3)
87+
axs[0, 0].set_facecolor("#ddddff")
88+
axs[2, 2].set_facecolor("#ffffdd")
8989
\end{lstlisting}
9090
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{layout-subplot-color.pdf}}
9191
\end{tabular}
@@ -130,7 +130,7 @@ \subsection*{\rmfamily Lines \& markers}
130130
\begin{lstlisting}
131131
X = np.linspace(0.1, 10*np.pi, 1000)
132132
Y = np.sin(X)
133-
ax.plot(X, Y, "C1o:", markevery=25, mec="1.0")
133+
ax.plot(X, Y, "C1o:", markevery=50, mec="1.0")
134134
\end{lstlisting}
135135
\includegraphics[width=\linewidth]{sine-marker.pdf}
136136

@@ -140,13 +140,13 @@ \subsection*{\rmfamily Scales \& projections}
140140
\begin{lstlisting}
141141
fig, ax = plt.subplots()
142142
ax.set_xscale("log")
143-
ax.plot(X, Y, "C1o-", markevery=25, mec="1.0")
143+
ax.plot(X, Y, "C1o-", markevery=50, mec="1.0")
144144
\end{lstlisting}
145145
\includegraphics[width=\linewidth]{sine-logscale.pdf}
146146

147147
\subsection*{\rmfamily Text \& ornaments}
148148
\begin{lstlisting}[]
149-
ax.fill_betweenx([-1,1],[0],[2*np.pi])
149+
ax.fill_betweenx([-1, 1], [0], [2*np.pi])
150150
ax.text(0, -1, r" Period $\Phi$")
151151
\end{lstlisting}
152152
\includegraphics[width=\linewidth]{sine-period.pdf}
@@ -157,17 +157,17 @@ \subsection*{\rmfamily Legend}
157157
\begin{lstlisting}[]
158158
ax.plot(X, np.sin(X), "C0", label="Sine")
159159
ax.plot(X, np.cos(X), "C1", label="Cosine")
160-
ax.legend(bbox_to_anchor=(0,1,1,.1),ncol=2,
161-
mode="expand", loc="lower left")
160+
ax.legend(bbox_to_anchor=(0,1,1,.1), ncol=2,
161+
mode="expand", loc="lower left")
162162
\end{lstlisting}
163163
\includegraphics[width=\linewidth]{sine-legend.pdf}
164164

165165
% -----------------------------------------------------------------------------
166166
\subsection*{\rmfamily Annotation}
167167
\begin{lstlisting}[]
168-
ax.annotate("A", (X[250],Y[250]),(X[250],-1),
169-
ha="center", va="center",arrowprops =
170-
{"arrowstyle" : "->", "color": "C1"})
168+
ax.annotate("A", (X[250],Y[250]), (X[250],-1),
169+
ha="center", va="center", arrowprops={
170+
"arrowstyle": "->", "color": "C1"})
171171
\end{lstlisting}
172172
\includegraphics[width=\linewidth]{sine-annotate.pdf}
173173

@@ -185,12 +185,12 @@ \subsection*{\rmfamily Colors}
185185
\vspace{-1em}
186186
\subsection*{\rmfamily Size \& DPI}
187187

188-
Consider a square figure to be included in a two-columns A4 paper with
189-
2cm margins on each side and a column separation of 1cm. The width of
190-
a figure is (21 - 2*2 - 1)/2 = 8cm. One inch being 2.54cm, figure size
191-
should be 3.15$\times$3.15 in.
188+
Consider a square figure to be included in a two-column A4 paper with
189+
2\,cm margins on each side and a column separation of 1\,cm. The width of
190+
a figure is (21 - 2*2 - 1)/2 = 8\,cm. One inch being 2.54\,cm, figure size
191+
should be 3.15$\times$3.15\,in.
192192
\begin{lstlisting}[]
193-
fig = plt.figure(figsize=(3.15,3.15), dpi=50)
193+
fig = plt.figure(figsize=(3.15, 3.15), dpi=50)
194194
plt.savefig("figure.pdf", dpi=600)
195195
\end{lstlisting}
196196

0 commit comments

Comments
 (0)