Skip to content

Commit 5f45dcb

Browse files
authored
Merge pull request #93 from timhoffm/param-format
Formatting adjustments
2 parents aa80eee + 3be24b7 commit 5f45dcb

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Diff for: cheatsheets.tex

+16-16
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
Y = np.cos(X)\\
287287
\\
288288
fig, ax = plt.subplots()\\
289-
ax.plot(X,Y,color='C1')\\
289+
ax.plot(X, Y, color='green')\\
290290
\\
291291
fig.savefig(``figure.pdf'')\\
292292
fig.show() }
@@ -303,7 +303,7 @@
303303
\API{https://matplotlib.org/tutorials/intermediate/gridspec.html} }
304304
\plot{layout-subplot.pdf}{\textbf{subplot[s]}(rows,cols,…)}
305305
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplots.html}
306-
{\ttfamily fig, axs = plt.subplots(3,3)}
306+
{\ttfamily fig, axs = plt.subplots(3, 3)}
307307
{}
308308
\plot{layout-gridspec.pdf}{G = \textbf{gridspec}(rows,cols,…)}
309309
{https://matplotlib.org/stable/api/_as_gen/matplotlib.gridspec.GridSpec.html}
@@ -313,7 +313,7 @@
313313
{}{}
314314
\plot{layout-divider.pdf}{d=\textbf{make\_axes\_locatable}(ax)}
315315
{https://matplotlib.org/mpl_toolkits/axes_grid/users/axes_divider.html}
316-
{\ttfamily ax=d.new\_horizontal('10\%')}{}
316+
{\ttfamily ax = d.new\_horizontal('10\%')}{}
317317
\end{myboxed}
318318
\vspace{\fill}
319319

@@ -364,15 +364,15 @@
364364
\optional{bottom},
365365
\optional{align},
366366
\optional{color} }{}
367-
\plot{basic-imshow.pdf}{\textbf{imshow}(Z,[cmap],…)}
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},
@@ -401,7 +401,7 @@
401401
\optional{units},
402402
\optional{angles} }
403403
{}
404-
\plot{basic-pie.pdf}{\textbf{pie}(X,[explode],…)}
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},
@@ -420,7 +420,7 @@
420420
\optional{weight},
421421
\optional{transform} }
422422
{}
423-
\plot{basic-fill.pdf}{\textbf{fill[\_between][x]}()}
423+
\plot{basic-fill.pdf}{\textbf{fill[\_between][x]}()}
424424
{https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.fill.html}
425425
{\mandatory{X},
426426
\optional{Y1},
@@ -666,13 +666,13 @@
666666
{\ttfamily \scriptsize
667667
import matplotlib.animation as mpla\par
668668
~\par
669-
T = np.linspace(0,2*np.pi,100)\par
669+
T = np.linspace(0, 2*np.pi, 100)\par
670670
S = np.sin(T)\par
671671
line, = plt.plot(T, S)\par
672672
def animate(i):\par
673-
~~line.set\_ydata(np.sin(T+i/50))\par
673+
~~~~line.set\_ydata(np.sin(T+i/50))\par
674674
anim = mpla.FuncAnimation(\par
675-
~~plt.gcf(), animate, interval=5)\par
675+
~~~~plt.gcf(), animate, interval=5)\par
676676
plt.show()\par
677677
}
678678
\end{myboxed}
@@ -794,7 +794,7 @@
794794
%
795795
\begin{myboxed}{Text alignments \hfill
796796
\API{https://matplotlib.org/tutorials/text/text_props.html} }
797-
ax.\textbf{text}( …, ha=… , va=…, … )\\
797+
ax.\textbf{text}( …, ha=… , va=…, …)\\
798798

799799
\includegraphics[width=\columnwidth]{text-alignments.pdf}
800800
\end{myboxed}
@@ -803,8 +803,8 @@
803803
%
804804
\begin{myboxed}{Text parameters \hfill
805805
\API{https://matplotlib.org/tutorials/text/text_props.html}}
806-
ax.\textbf{text}( …, family=… , size=…, weight = …)\\
807-
ax.\textbf{text}( …, fontproperties = … )\\
806+
ax.\textbf{text}(…, family=…, size=…, weight=…)\\
807+
ax.\textbf{text}(…, fontproperties=…)\\
808808

809809
\includegraphics[width=\columnwidth]{fonts.pdf}
810810
\end{myboxed}
@@ -963,7 +963,7 @@
963963
%
964964
\begin{myboxed}{How do I …}
965965
\textbf{… resize a figure?}\\
966-
\hspace*{2.5mm}~$\rightarrow$ fig.set\_size\_inches(w,h)\\
966+
\hspace*{2.5mm}~$\rightarrow$ fig.set\_size\_inches(w, h)\\
967967
\textbf{… save a figure?}\\
968968
\hspace*{2.5mm}~$\rightarrow$ fig.savefig("figure.pdf")\\
969969
\textbf{… save a transparent figure?}\\
@@ -985,15 +985,15 @@
985985
\textbf{… show error as shaded region?}\\
986986
\hspace*{2.5mm}~$\rightarrow$ ax.fill\_between(X, Y+error, Y-error)\\
987987
\textbf{… draw a rectangle?}\\
988-
\hspace*{2.5mm}~$\rightarrow$ ax.add\_patch(plt.Rectangle((0, 0),1,1)\\
988+
\hspace*{2.5mm}~$\rightarrow$ ax.add\_patch(plt.Rectangle((0, 0), 1, 1)\\
989989
\textbf{… draw a vertical line?}\\
990990
\hspace*{2.5mm}~$\rightarrow$ ax.axvline(x=0.5)\\
991991
\textbf{… draw outside frame?}\\
992992
\hspace*{2.5mm}~$\rightarrow$ ax.plot(…, clip\_on=False)\\
993993
\textbf{… use transparency?}\\
994994
\hspace*{2.5mm}~$\rightarrow$ ax.plot(…, alpha=0.25)\\
995995
\textbf{… convert an RGB image into a gray image? }\\
996-
\hspace*{2.5mm}~$\rightarrow$ gray = 0.2989*R+0.5870*G+0.1140*B\\
996+
\hspace*{2.5mm}~$\rightarrow$ gray = 0.2989*R + 0.5870*G + 0.1140*B\\
997997
\textbf{… set figure background color?}\\
998998
\hspace*{2.5mm}~$\rightarrow$ fig.patch.set\_facecolor(``grey'')\\
999999
\textbf{… get a reversed colormap?}\\

0 commit comments

Comments
 (0)