From 982b0634ca33492294b3672f849bcfdb94615949 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 6 Feb 2024 03:08:01 -0500 Subject: [PATCH 1/3] Add spaces after commas wherever possible Only a couple don't fit, so try to combine things that are related in those cases. --- cheatsheets.tex | 56 ++++++++++++++++++++-------------------- handout-beginner.tex | 10 +++---- handout-intermediate.tex | 20 +++++++------- handout-tips.tex | 14 +++++----- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/cheatsheets.tex b/cheatsheets.tex index f7462c7..977de19 100644 --- a/cheatsheets.tex +++ b/cheatsheets.tex @@ -301,13 +301,13 @@ % --- Layout --------------------------------------------------------------- \begin{myboxed}{Subplots layout \hfill \API{https://matplotlib.org/tutorials/intermediate/gridspec.html} } - \plot{layout-subplot.pdf}{\textbf{subplot[s]}(rows,cols,…)} + \plot{layout-subplot.pdf}{\textbf{subplot[s]}(rows, cols, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplots.html} {\ttfamily fig, axs = plt.subplots(3, 3)} {} - \plot{layout-gridspec.pdf}{G = \textbf{gridspec}(rows,cols,…)} + \plot{layout-gridspec.pdf}{G = \textbf{gridspec}(rows,cols, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.gridspec.GridSpec.html} - {\ttfamily ax = G[0,:]}{} + {\ttfamily ax = G[0, :]}{} \plot{layout-inset.pdf}{ax.\textbf{inset\_axes}(extent)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.inset_axes.html} {}{} @@ -338,7 +338,7 @@ % --- Basic plots ----------------------------------------------------------- \begin{myboxed}{Basic plots} - \plot{basic-plot.pdf}{\textbf{plot}([X],Y,[fmt],…)} + \plot{basic-plot.pdf}{\textbf{plot}([X], Y, [fmt], …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html} {\optional{X}, \mandatory{Y}, @@ -347,7 +347,7 @@ \optional{marker}, \optional{linestyle}} {} - \plot{basic-scatter.pdf}{\textbf{scatter}(X,Y,…)} + \plot{basic-scatter.pdf}{\textbf{scatter}(X, Y, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html} {\mandatory{X}, \mandatory{Y}, @@ -356,7 +356,7 @@ \optional{marker}, \optional{cmap}} {} - \plot{basic-bar.pdf}{\textbf{bar[h]}(x,height,…)} + \plot{basic-bar.pdf}{\textbf{bar[h]}(x, height, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.bar.html} { \mandatory{x}, \mandatory{height}, @@ -364,7 +364,7 @@ \optional{bottom}, \optional{align}, \optional{color} }{} - \plot{basic-imshow.pdf}{\textbf{imshow}(Z,…)} + \plot{basic-imshow.pdf}{\textbf{imshow}(Z, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html} { \mandatory{Z}, \optional{cmap}, @@ -372,7 +372,7 @@ \optional{extent}, \optional{origin} } {} - \plot{basic-contour.pdf}{\textbf{contour[f]}([X],[Y],Z,…)} + \plot{basic-contour.pdf}{\textbf{contour[f]}([X], [Y], Z, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.contour.html} { \optional{X}, \optional{Y}, @@ -382,7 +382,7 @@ \optional{extent}, \optional{origin} } {} - \plot{basic-pcolormesh.pdf}{\textbf{pcolormesh}([X],[Y],Z,…)} + \plot{basic-pcolormesh.pdf}{\textbf{pcolormesh}([X], [Y], Z, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pcolormesh.html} { \optional{X}, \optional{Y}, @@ -391,7 +391,7 @@ \optional{vmax}, \optional{cmap}} {} - \plot{basic-quiver.pdf}{\textbf{quiver}([X],[Y],U,V,…)} + \plot{basic-quiver.pdf}{\textbf{quiver}([X], [Y], U, V, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.quiver.html} { \optional{X}, \optional{Y}, @@ -401,7 +401,7 @@ \optional{units}, \optional{angles} } {} - \plot{basic-pie.pdf}{\textbf{pie}(X,…)} + \plot{basic-pie.pdf}{\textbf{pie}(X, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pie.html} {\mandatory{Z}, \optional{explode}, @@ -409,7 +409,7 @@ \optional{colors}, \optional{radius}} {} - \plot{basic-text.pdf}{\textbf{text}(x,y,text,…)} + \plot{basic-text.pdf}{\textbf{text}(x, y, text, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.text.html} {\mandatory{x}, \mandatory{y}, @@ -432,7 +432,7 @@ \vspace{\fill} % --- Advanced plots -------------------------------------------------------- \begin{myboxed}{Advanced plots} - \plot{advanced-step.pdf}{\textbf{step}(X,Y,[fmt],…)} + \plot{advanced-step.pdf}{\textbf{step}(X, Y, [fmt], …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.step.html} {\mandatory{X}, \mandatory{Y}, @@ -441,7 +441,7 @@ \optional{marker}, \optional{where} } {} - \plot{advanced-boxplot.pdf}{\textbf{boxplot}(X,…)} + \plot{advanced-boxplot.pdf}{\textbf{boxplot}(X, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.boxplot.html} { \mandatory{X}, \optional{notch}, @@ -449,7 +449,7 @@ \optional{bootstrap}, \optional{widths} } {} - \plot{advanced-errorbar.pdf}{\textbf{errorbar}(X,Y,xerr,yerr,…)} + \plot{advanced-errorbar.pdf}{\textbf{errorbar}(X,Y,xerr,yerr, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.errorbar.html} { \mandatory{X}, \mandatory{Y}, @@ -465,14 +465,14 @@ \optional{density}, \optional{weights}} {} - \plot{advanced-violin.pdf}{\textbf{violinplot}(D,…)} + \plot{advanced-violin.pdf}{\textbf{violinplot}(D, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.violinplot.html} {\mandatory{D}, \optional{positions}, \optional{widths}, \optional{vert} } {} - \plot{advanced-barbs.pdf}{\textbf{barbs}([X],[Y], U, V, …)} + \plot{advanced-barbs.pdf}{\textbf{barbs}([X], [Y], U, V, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.barbs.html} { \optional{X}, \optional{Y}, @@ -483,13 +483,13 @@ \optional{pivot}, \optional{sizes} } {} - \plot{advanced-event.pdf}{\textbf{eventplot}(positions,…)} + \plot{advanced-event.pdf}{\textbf{eventplot}(positions, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.eventplot.html} {\mandatory{positions}, \optional{orientation}, \optional{lineoffsets} } {} - \plot{advanced-hexbin.pdf}{\textbf{hexbin}(X,Y,C,…)} + \plot{advanced-hexbin.pdf}{\textbf{hexbin}(X, Y, C, …)} {https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hexbin.html} {\mandatory{X}, \mandatory{Y}, @@ -503,7 +503,7 @@ % --- Scale --------------------------------------------------------------- \begin{myboxed}{Scales \hfill \API{https://matplotlib.org/stable/api/scale_api.html}} - {\ttfamily ax.\textbf{set\_[xy]scale}(scale,…)} + {\ttfamily ax.\textbf{set\_[xy]scale}(scale, …)} \smallskip \scale{scale-linear.pdf}{\textbf{linear}}{any values} \scale{scale-log.pdf}{\textbf{log}}{values > 0} @@ -516,7 +516,7 @@ % --- Projections ----------------------------------------------------------- \begin{myboxed}{Projections \hfill \API{https://matplotlib.org/stable/api/projections_api.html}} - {\ttfamily \textbf{subplot}(…,projection=p)} + {\ttfamily \textbf{subplot}(…, projection=p)} \smallskip \scale{projection-polar.pdf}{p='polar'}{} \scale{projection-3d.pdf} @@ -906,7 +906,7 @@ \begin{myboxed}{Legend placement} \includegraphics[width=\columnwidth]{legend-placement.pdf} - ax.\textbf{legend}(loc="string", bbox\_to\_anchor=(x,y))\\ + ax.\textbf{legend}(loc="string", bbox\_to\_anchor=(x, y))\\ \begin{tabular}{@{}p{0.33\columnwidth} p{0.33\columnwidth} p{0.33\columnwidth}@{}} @@ -919,12 +919,12 @@ \begin{tabular}{@{}p{0.495\columnwidth} p{0.495\columnwidth}@{}} \scriptsize \rule{0pt}{1.25em}\noindent - \tiny A: upper right / {\ttfamily (-0.1,0.9)} & \tiny B: center right / {\ttfamily (-0.1,0.5)}\\ - \tiny C: lower right / {\ttfamily (-0.1,0.1)} & \tiny D: upper left / {\ttfamily (0.1,-0.1)}\\ - \tiny E: upper center / {\ttfamily (0.5,-0.1)} & \tiny F: upper right / {\ttfamily (0.9,-0.1)}\\ - \tiny G: lower left / {\ttfamily (1.1,0.1)} & \tiny H: center left / {\ttfamily (1.1,0.5)}\\ - \tiny I: upper left / {\ttfamily (1.1,0.9)} & \tiny J: lower right / {\ttfamily (0.9,1.1)}\\ - \tiny K: lower center / {\ttfamily (0.5,1.1)} & \tiny L: lower left / {\ttfamily (0.1,1.1)} + \tiny A: upper right / {\ttfamily (-0.1, 0.9)} & \tiny B: center right / {\ttfamily (-0.1, 0.5)}\\ + \tiny C: lower right / {\ttfamily (-0.1, 0.1)} & \tiny D: upper left / {\ttfamily (0.1, -0.1)}\\ + \tiny E: upper center / {\ttfamily (0.5, -0.1)} & \tiny F: upper right / {\ttfamily (0.9, -0.1)}\\ + \tiny G: lower left / {\ttfamily (1.1, 0.1)} & \tiny H: center left / {\ttfamily (1.1, 0.5)}\\ + \tiny I: upper left / {\ttfamily (1.1, 0.9)} & \tiny J: lower right / {\ttfamily (0.9, 1.1)}\\ + \tiny K: lower center / {\ttfamily (0.5, 1.1)} & \tiny L: lower left / {\ttfamily (0.1, 1.1)} \end{tabular} \end{myboxed} % diff --git a/handout-beginner.tex b/handout-beginner.tex index da99d28..1d5b11a 100644 --- a/handout-beginner.tex +++ b/handout-beginner.tex @@ -123,7 +123,7 @@ \subsection*{\rmfamily Choose} % ----------------------------------------------------------------------------- \begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}} \begin{lstlisting}[belowskip=-\baselineskip] - Z = np.random.uniform(0, 1, (8,8)) + Z = np.random.uniform(0, 1, (8, 8)) ax.imshow(Z) \end{lstlisting} @@ -132,7 +132,7 @@ \subsection*{\rmfamily Choose} % ----------------------------------------------------------------------------- \begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}} \begin{lstlisting}[belowskip=-\baselineskip] - Z = np.random.uniform(0, 1, (8,8)) + Z = np.random.uniform(0, 1, (8, 8)) ax.contourf(Z) \end{lstlisting} @@ -168,7 +168,7 @@ \subsection*{\rmfamily Choose} % ----------------------------------------------------------------------------- \begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}} \begin{lstlisting}[belowskip=-\baselineskip] - Z = np.random.normal(0, 1, (100,3)) + Z = np.random.normal(0, 1, (100, 3)) ax.boxplot(Z) \end{lstlisting} @@ -240,7 +240,7 @@ \subsection*{\rmfamily Organize} % ----------------------------------------------------------------------------- \begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}} \begin{lstlisting}[belowskip=-\baselineskip] - fig, (ax1, ax2) = plt.subplots(2,1) + fig, (ax1, ax2) = plt.subplots(2, 1) ax1.plot(X, Y1, color="C1") ax2.plot(X, Y2, color="C0") \end{lstlisting} @@ -249,7 +249,7 @@ \subsection*{\rmfamily Organize} % ----------------------------------------------------------------------------- \begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}} \begin{lstlisting}[belowskip=-\baselineskip] - fig, (ax1, ax2) = plt.subplots(1,2) + fig, (ax1, ax2) = plt.subplots(1, 2) ax1.plot(Y1, X, color="C1") ax2.plot(Y2, X, color="C0") \end{lstlisting} diff --git a/handout-intermediate.tex b/handout-intermediate.tex index 7a6b679..9deff8e 100644 --- a/handout-intermediate.tex +++ b/handout-intermediate.tex @@ -83,9 +83,9 @@ \subsection*{\rmfamily Figure, axes \& spines} % ----------------------------------------------------------------------------- \begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}} \begin{lstlisting}[belowskip=-\baselineskip] - fig, axs = plt.subplots(3,3) - axs[0,0].set_facecolor("#ddddff") - axs[2,2].set_facecolor("#ffffdd") + fig, axs = plt.subplots(3, 3) + axs[0, 0].set_facecolor("#ddddff") + axs[2, 2].set_facecolor("#ffffdd") \end{lstlisting} & \raisebox{-0.75em}{\includegraphics[width=\linewidth]{layout-subplot-color.pdf}} \end{tabular} @@ -146,7 +146,7 @@ \subsection*{\rmfamily Scales \& projections} \subsection*{\rmfamily Text \& ornaments} \begin{lstlisting}[] - ax.fill_betweenx([-1,1],[0],[2*np.pi]) + ax.fill_betweenx([-1, 1], [0], [2*np.pi]) ax.text(0, -1, r" Period $\Phi$") \end{lstlisting} \includegraphics[width=\linewidth]{sine-period.pdf} @@ -157,17 +157,17 @@ \subsection*{\rmfamily Legend} \begin{lstlisting}[] ax.plot(X, np.sin(X), "C0", label="Sine") ax.plot(X, np.cos(X), "C1", label="Cosine") - ax.legend(bbox_to_anchor=(0,1,1,.1),ncol=2, - mode="expand", loc="lower left") + ax.legend(bbox_to_anchor=(0,1,1,.1), ncol=2, + mode="expand", loc="lower left") \end{lstlisting} \includegraphics[width=\linewidth]{sine-legend.pdf} % ----------------------------------------------------------------------------- \subsection*{\rmfamily Annotation} \begin{lstlisting}[] - ax.annotate("A", (X[250],Y[250]),(X[250],-1), - ha="center", va="center",arrowprops = - {"arrowstyle" : "->", "color": "C1"}) + ax.annotate("A", (X[250],Y[250]), (X[250],-1), + ha="center", va="center", arrowprops={ + "arrowstyle": "->", "color": "C1"}) \end{lstlisting} \includegraphics[width=\linewidth]{sine-annotate.pdf} @@ -190,7 +190,7 @@ \subsection*{\rmfamily Size \& DPI} a figure is (21 - 2*2 - 1)/2 = 8cm. One inch being 2.54cm, figure size should be 3.15$\times$3.15 in. \begin{lstlisting}[] - fig = plt.figure(figsize=(3.15,3.15), dpi=50) + fig = plt.figure(figsize=(3.15, 3.15), dpi=50) plt.savefig("figure.pdf", dpi=600) \end{lstlisting} diff --git a/handout-tips.tex b/handout-tips.tex index 3e5e261..5e4d0a9 100644 --- a/handout-tips.tex +++ b/handout-tips.tex @@ -168,10 +168,10 @@ \subsection*{\rmfamily Dotted lines} To have rounded dotted lines, use a custom {\ttfamily linestyle} and modify {\ttfamily dash\_capstyle}. \begin{lstlisting} - ax.plot([0,1], [0,0], "C1", - linestyle = (0, (0.01, 1)), dash_capstyle="round") - ax.plot([0,1], [1,1], "C1", - linestyle = (0, (0.01, 2)), dash_capstyle="round") + ax.plot([0, 1], [0, 0], "C1", + linestyle=(0, (0.01, 1)), dash_capstyle="round") + ax.plot([0, 1], [1, 1], "C1", + linestyle=(0, (0.01, 2)), dash_capstyle="round") \end{lstlisting} \includegraphics[width=\linewidth]{tip-dotted.pdf} @@ -181,9 +181,9 @@ \subsection*{\rmfamily Combining axes} \begin{tabular}{@{}m{.774\linewidth}m{.216\linewidth}} \begin{lstlisting}[belowskip=-\baselineskip] - ax1 = fig.add_axes([0,0,1,1], + ax1 = fig.add_axes([0, 0, 1, 1], label="cartesian") - ax2 = fig.add_axes([0,0,1,1], + ax2 = fig.add_axes([0, 0, 1, 1], label="polar", projection="polar") \end{lstlisting} & @@ -227,7 +227,7 @@ \subsection*{\rmfamily Hatching} cmap = plt.get_cmap("Oranges") plt.rcParams['hatch.color'] = cmap(0.2) plt.rcParams['hatch.linewidth'] = 8 - ax.bar(X, Y, color=cmap(0.6), hatch="/" ) + ax.bar(X, Y, color=cmap(0.6), hatch="/") \end{lstlisting} & \raisebox{-0.75em}{\includegraphics[width=\linewidth]{tip-hatched.pdf}} \end{tabular} From d5bdedd793917d90305495dc0348301ade22c3a1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 6 Feb 2024 03:15:00 -0500 Subject: [PATCH 2/3] Fix typos in sine plots - Use `C1` instead of `orange` to match other plots. - Remove extra plot in `sine-logscale.pdf`, which causes a bit of artifacting around the line. - Ensure text matches what is actually plotted for `markevery` settings; note I divided by 10 so that the text would fit in the block. Fixes #133 --- handout-beginner.tex | 2 +- handout-intermediate.tex | 4 ++-- scripts/sine.py | 26 ++++++++++++++++---------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/handout-beginner.tex b/handout-beginner.tex index 1d5b11a..30a106a 100644 --- a/handout-beginner.tex +++ b/handout-beginner.tex @@ -83,7 +83,7 @@ \section*{\LARGE \rmfamily % \fbox{2} \textbf{Prepare} \begin{lstlisting} - X = np.linspace(0, 4*np.pi, 1000) + X = np.linspace(0, 10*np.pi, 1000) Y = np.sin(X) \end{lstlisting} % diff --git a/handout-intermediate.tex b/handout-intermediate.tex index 9deff8e..0efd05d 100644 --- a/handout-intermediate.tex +++ b/handout-intermediate.tex @@ -130,7 +130,7 @@ \subsection*{\rmfamily Lines \& markers} \begin{lstlisting} X = np.linspace(0.1, 10*np.pi, 1000) Y = np.sin(X) - ax.plot(X, Y, "C1o:", markevery=25, mec="1.0") + ax.plot(X, Y, "C1o:", markevery=50, mec="1.0") \end{lstlisting} \includegraphics[width=\linewidth]{sine-marker.pdf} @@ -140,7 +140,7 @@ \subsection*{\rmfamily Scales \& projections} \begin{lstlisting} fig, ax = plt.subplots() ax.set_xscale("log") - ax.plot(X, Y, "C1o-", markevery=25, mec="1.0") + ax.plot(X, Y, "C1o-", markevery=50, mec="1.0") \end{lstlisting} \includegraphics[width=\linewidth]{sine-logscale.pdf} diff --git a/scripts/sine.py b/scripts/sine.py index 0e6a347..6307629 100644 --- a/scripts/sine.py +++ b/scripts/sine.py @@ -16,28 +16,34 @@ ROOT_DIR / 'styles/sine-plot.mplstyle', ]) -X = np.linspace(0.1, 10*np.pi, 10000) +X = np.linspace(0, 10*np.pi, 1000) Y = np.sin(X) -(fig, ax) = plt.subplots(figsize=(5.7/2.54, 1.2/2.54)) + +fig, ax = plt.subplots(figsize=(5.7/2.54, 1.2/2.54)) ax.set_yticks(np.linspace(-1, 1, 5)) -ax.plot(X, Y, color="orange") +ax.plot(X, Y, color="C1") fig.savefig(ROOT_DIR / "figures/sine.pdf") -(fig, ax) = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) -ax.plot(X, Y, "C1o:", markevery=500, mec="1.0") + +X = np.linspace(0.1, 10*np.pi, 1000) +Y = np.sin(X) + + +fig, ax = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) +ax.plot(X, Y, "C1o:", markevery=50, mec="1.0") ax.set_ylim(-1.5, 1.5) fig.savefig(ROOT_DIR / "figures/sine-marker.pdf") + fig, ax = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) ax.set_xscale("log") -ax.plot(X, Y, "-") -ax.plot(X, Y, "C1o-", markevery=500, mec="1.0") +ax.plot(X, Y, "C1o-", markevery=50, mec="1.0") ax.set_ylim(-1.5, 1.5) fig.savefig(ROOT_DIR / "figures/sine-logscale.pdf") -(fig, ax) = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) +fig, ax = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) ax.plot(X, Y, "C1") ax.fill_betweenx([-1.5, 1.5], [0], [2*np.pi], color=".9") ax.text(0, -1, r" Period $\Phi$", va="top") @@ -45,7 +51,7 @@ fig.savefig(ROOT_DIR / "figures/sine-period.pdf") -(fig, ax) = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) +fig, ax = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) ax.plot(X, np.sin(X), "C0", label="Sine") ax.plot(X, np.cos(X), "C1", label="Cosine") ax.legend(bbox_to_anchor=(0.0, .9, 1.02, 0.1), @@ -56,7 +62,7 @@ fig.savefig(ROOT_DIR / "figures/sine-legend.pdf") -(fig, ax) = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) +fig, ax = plt.subplots(figsize=(5.7/2.54, 1.0/2.54)) X = np.linspace(0, 10*np.pi, 1000) Y = np.sin(X) ax.plot(X, Y, "C1o-", markevery=50, mec="1.0") From 1b461e7e36b5e4ab2e3203612b92339cba5cd0f5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 6 Feb 2024 05:02:37 -0500 Subject: [PATCH 3/3] Fix typos in tips I'm not sure what the tip in Performance section is supposed to do, but the slow part plots nothing, and the fast part doesn't run. --- cheatsheets.tex | 8 ++++---- handout-beginner.tex | 4 ++-- handout-intermediate.tex | 8 ++++---- handout-tips.tex | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cheatsheets.tex b/cheatsheets.tex index 977de19..2b5ccfe 100644 --- a/cheatsheets.tex +++ b/cheatsheets.tex @@ -1000,12 +1000,12 @@ plot(X, Y, marker="o", ls="") \hfill fast% \vskip.5\baselineskip % - \textcolor{red}{for i in range(n): plot(X[i]) \hfill slow}\\ - plot(sum([x+[None] for x in X],[])) \hfill fast% + \textcolor{red}{for i in range(n): plot(i, X[i], "o") \hfill slow}\\ + plot(X, marker="o", ls="") \hfill fast% \vskip.5\baselineskip % - \textcolor{red}{cla(), imshow(…), canvas.draw() \hfill slow}\\ - im.set\_data(…), canvas.draw() \hfill fast% + \textcolor{red}{cla(); imshow(…); canvas.draw() \hfill slow}\\ + im.set\_data(…); canvas.draw() \hfill fast% \vskip.1\baselineskip } \end{myboxed} diff --git a/handout-beginner.tex b/handout-beginner.tex index 30a106a..37b0e05 100644 --- a/handout-beginner.tex +++ b/handout-beginner.tex @@ -225,8 +225,8 @@ \subsection*{\rmfamily Tweak} \subsection*{\rmfamily Organize} % ----------------------------------------------------------------------------- -You can plot several data on the the same figure, but you can also -split a figure in several subplots (named {\em Axes}): \medskip +You can plot several data on the same figure, but you can also split a figure +in several subplots (named {\em Axes}): \medskip % ----------------------------------------------------------------------------- \begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}} diff --git a/handout-intermediate.tex b/handout-intermediate.tex index 0efd05d..16f85f5 100644 --- a/handout-intermediate.tex +++ b/handout-intermediate.tex @@ -185,10 +185,10 @@ \subsection*{\rmfamily Colors} \vspace{-1em} \subsection*{\rmfamily Size \& DPI} -Consider a square figure to be included in a two-columns A4 paper with -2cm margins on each side and a column separation of 1cm. The width of -a figure is (21 - 2*2 - 1)/2 = 8cm. One inch being 2.54cm, figure size -should be 3.15$\times$3.15 in. +Consider a square figure to be included in a two-column A4 paper with +2\,cm margins on each side and a column separation of 1\,cm. The width of +a figure is (21 - 2*2 - 1)/2 = 8\,cm. One inch being 2.54\,cm, figure size +should be 3.15$\times$3.15\,in. \begin{lstlisting}[] fig = plt.figure(figsize=(3.15, 3.15), dpi=50) plt.savefig("figure.pdf", dpi=600) diff --git a/handout-tips.tex b/handout-tips.tex index 5e4d0a9..a6f7dd4 100644 --- a/handout-tips.tex +++ b/handout-tips.tex @@ -153,7 +153,7 @@ \subsection*{\rmfamily Text outline} % ----------------------------------------------------------------------------- \subsection*{\rmfamily Multiline plot} -You can plot several lines at once using None as separator. +You can plot several lines at once using {\em None} as separator. \begin{lstlisting} X,Y = [], []