|
782 | 782 | %
|
783 | 783 | \vspace{\fill}
|
784 | 784 | %
|
785 |
| - \begin{myboxed}{Text aligmnents \hfill |
| 785 | + \begin{myboxed}{Text alignments \hfill |
786 | 786 | \API{https://matplotlib.org/tutorials/text/text_props.html} }
|
787 | 787 | plt.\textbf{text}( …, ha=… , va=…, … )\\
|
788 | 788 |
|
|
892 | 892 |
|
893 | 893 |
|
894 | 894 |
|
895 |
| - \begin{myboxed}{Color names} |
| 895 | + \begin{myboxed}{Color names \hfill |
| 896 | + \API{https://matplotlib.org/api/colors_api.html} } |
896 | 897 | \includegraphics[width=\columnwidth]{colornames.pdf}
|
897 | 898 | \end{myboxed}
|
898 | 899 | %
|
899 | 900 | \vspace{\fill}
|
900 | 901 | %
|
901 |
| - \begin{myboxed}{Image interpolation} |
| 902 | + \begin{myboxed}{Image interpolation |
| 903 | + \hfill \API{https://matplotlib.org/gallery/images_contours_and_fields/interpolation_methods.html} } |
| 904 | + \smallskip |
902 | 905 | %% plt.\textbf{imshow}(…, interpolation=…)\\
|
903 | 906 | %% plt.\textbf{contour[f]}(…, interpolation=…)\\
|
904 | 907 | \includegraphics[width=\columnwidth]{interpolations.pdf}
|
|
947 | 950 | \hspace*{2.5mm}~$\rightarrow$ ax.set\_xticks([])\\
|
948 | 951 | \textbf{… remove tick labels ?}\\
|
949 | 952 | \hspace*{2.5mm}~$\rightarrow$ ax.set\_[xy]ticklabels([])\\
|
| 953 | + \textbf{… rotate tick labels ?}\\ |
| 954 | + \hspace*{2.5mm}~$\rightarrow$ plt.[xy]ticks(rotation=90)\\ |
950 | 955 | \textbf{… hide top spine?}\\
|
951 | 956 | \hspace*{2.5mm}~$\rightarrow$ ax.spines['top'].set\_visible(False)\\
|
952 | 957 | \textbf{… hide legend border?}\\
|
|
965 | 970 | \hspace*{2.5mm}~$\rightarrow$ plt.get\_cmap(``viridis\_r'')\\
|
966 | 971 | \textbf{… get a discrete colormap?}\\
|
967 | 972 | \hspace*{2.5mm}~$\rightarrow$ plt.get\_cmap(``viridis'', 10)\\
|
968 |
| - \textbf{… rotate tick labels ?}\\ |
969 |
| - \hspace*{2.5mm}~$\rightarrow$ plt.[xy]ticks(rotation=90)\\ |
970 | 973 | \textbf{… show a figure for one second?}\\
|
971 | 974 | \hspace*{2.5mm}~$\rightarrow$ plt.show(block=False), time.sleep(1)
|
972 | 975 | \end{myboxed}
|
973 | 976 | %
|
974 | 977 | \vspace{\fill}
|
975 | 978 | %
|
976 | 979 | \begin{myboxed}{Performance tips}
|
| 980 | + \smallskip |
977 | 981 | {\ttfamily \fontsize{6pt}{7pt}\selectfont
|
978 |
| - \textcolor{red}{ax.scatter(X, Y) \hfill slow}\\ |
979 |
| - ax.plot(X, Y, marker="o", ls="") \hfill fast\\ |
| 982 | + \textcolor{red}{scatter(X, Y) \hfill slow}\\ |
| 983 | + plot(X, Y, marker="o", ls="") \hfill fast\\ |
980 | 984 | \hrule \smallskip
|
981 |
| - \textcolor{red}{for i in range(0,n,2): \hfill (very) slow}\\ |
982 |
| - \hspace*{2.5mm}~\textcolor{red}{plt.plot(X[i:i+2], Y[i:i+2])}\\ |
983 |
| - |
984 |
| - X0, Y0 = X[0::2], Y[0::2] \hfill fast\\ |
985 |
| - X1, Y1 = X[1::2], Y[1::2]\\ |
986 |
| - S = [None]*len(X)\\ |
987 |
| - X = [v for t in zip(X0,X1,S) for v in t]\\ |
988 |
| - Y = [v for t in zip(Y0,Y1,S) for v in t]\\ |
989 |
| - plt.plot(X,Y)} |
| 985 | + \textcolor{red}{for i in range(n): plot(X[i]) \hfill slow}\\ |
| 986 | + plot(sum([x+[None] for x in X],[])) \hfill fast\\ |
| 987 | + \hrule \smallskip |
| 988 | + \textcolor{red}{cla(), imshow(…), canvas.draw() \hfill slow}\\ |
| 989 | + im.set\_data(…), canvas.draw() \hfill fast\smallskip |
| 990 | + } |
990 | 991 | \end{myboxed}
|
991 | 992 | %
|
992 | 993 | \vspace{\fill}
|
993 | 994 | %
|
994 | 995 | \begin{myboxed}{Beyond Matplotlib}
|
| 996 | + \smallskip |
995 | 997 | \href{https://seaborn.pydata.org/}{\textbf{Seaborn}}: Statistical Data Visualization\\
|
996 | 998 | \href{https://scitools.org.uk/cartopy/docs/latest/}{\textbf{Cartopy}}: Geospatial Data Processing\\
|
997 | 999 | \href{https://yt-project.org/doc/index.html}{\textbf{yt}}: Volumetric data Visualization\\
|
|
0 commit comments