Skip to content

Commit 982b063

Browse files
committed
Add spaces after commas wherever possible
Only a couple don't fit, so try to combine things that are related in those cases.
1 parent 05d47a5 commit 982b063

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

cheatsheets.tex

Lines changed: 28 additions & 28 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
%

handout-beginner.tex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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}
@@ -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: 10 additions & 10 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}
@@ -146,7 +146,7 @@ \subsection*{\rmfamily Scales \& projections}
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

@@ -190,7 +190,7 @@ \subsection*{\rmfamily Size \& DPI}
190190
a figure is (21 - 2*2 - 1)/2 = 8cm. One inch being 2.54cm, figure size
191191
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

handout-tips.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ \subsection*{\rmfamily Dotted lines}
168168
To have rounded dotted lines, use a custom {\ttfamily linestyle} and
169169
modify {\ttfamily dash\_capstyle}.
170170
\begin{lstlisting}
171-
ax.plot([0,1], [0,0], "C1",
172-
linestyle = (0, (0.01, 1)), dash_capstyle="round")
173-
ax.plot([0,1], [1,1], "C1",
174-
linestyle = (0, (0.01, 2)), dash_capstyle="round")
171+
ax.plot([0, 1], [0, 0], "C1",
172+
linestyle=(0, (0.01, 1)), dash_capstyle="round")
173+
ax.plot([0, 1], [1, 1], "C1",
174+
linestyle=(0, (0.01, 2)), dash_capstyle="round")
175175
\end{lstlisting}
176176
\includegraphics[width=\linewidth]{tip-dotted.pdf}
177177

@@ -181,9 +181,9 @@ \subsection*{\rmfamily Combining axes}
181181

182182
\begin{tabular}{@{}m{.774\linewidth}m{.216\linewidth}}
183183
\begin{lstlisting}[belowskip=-\baselineskip]
184-
ax1 = fig.add_axes([0,0,1,1],
184+
ax1 = fig.add_axes([0, 0, 1, 1],
185185
label="cartesian")
186-
ax2 = fig.add_axes([0,0,1,1],
186+
ax2 = fig.add_axes([0, 0, 1, 1],
187187
label="polar",
188188
projection="polar")
189189
\end{lstlisting} &
@@ -227,7 +227,7 @@ \subsection*{\rmfamily Hatching}
227227
cmap = plt.get_cmap("Oranges")
228228
plt.rcParams['hatch.color'] = cmap(0.2)
229229
plt.rcParams['hatch.linewidth'] = 8
230-
ax.bar(X, Y, color=cmap(0.6), hatch="/" )
230+
ax.bar(X, Y, color=cmap(0.6), hatch="/")
231231
\end{lstlisting} &
232232
\raisebox{-0.75em}{\includegraphics[width=\linewidth]{tip-hatched.pdf}}
233233
\end{tabular}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy