Skip to content

Commit be7ecc8

Browse files
authored
Merge branch 'main' into mpl38
2 parents 593853a + 0c22654 commit be7ecc8

File tree

14 files changed

+152
-163
lines changed

14 files changed

+152
-163
lines changed

.github/workflows/main.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
sudo apt install \
2323
fontconfig \
2424
imagemagick \
25-
libgeos++-dev \
26-
libproj-dev \
2725
poppler-utils
2826
python -m pip install --upgrade pip
2927
pip install -r requirements/requirements.txt

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ check:
4646
./check-num-pages.sh handout-tips.pdf 1
4747
./check-num-pages.sh handout-beginner.pdf 1
4848
./check-num-pages.sh handout-intermediate.pdf 1
49-
./check-links.py cheatsheets.pdf
5049
./check-diffs.py
50+
./check-links.py cheatsheets.pdf
5151

5252
.PHONY: docs
5353
docs:

cheatsheets.tex

Lines changed: 33 additions & 33 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}
@@ -1019,7 +1019,7 @@
10191019
\href{https://yt-project.org/doc/index.html}{\textbf{yt}}: Volumetric data visualization\\
10201020
\href{https://mpld3.github.io}{\textbf{mpld3}}: Bringing Matplotlib to the browser\\
10211021
\href{https://datashader.org/}{\textbf{Datashader}}: Large data processing pipeline\\
1022-
\href{https://plotnine.readthedocs.io/en/latest/}{\textbf{plotnine}}: A grammar of graphics for Python
1022+
\href{https://plotnine.org/}{\textbf{plotnine}}: A grammar of graphics for Python
10231023
\end{myboxed}
10241024
%
10251025
\begin{center}

check-links.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
refs = [ref for ref in pdf.get_references() if ref.reftype == 'url']
1010

11-
status_codes = list(map(lambda ref: pdfx.downloader.get_status_code(ref.ref), refs))
11+
status_codes = [pdfx.downloader.get_status_code(ref.ref) for ref in refs]
1212

13-
broken_links = [refs[idx].ref for idx in range(len(refs)) if status_codes[idx] != 200]
13+
broken_links = [(ref.ref, code) for ref, code in zip(refs, status_codes) if code != 200]
1414

1515
# it seems that Twitter does not respond well to the link checker and throws a 400
16-
if all(['twitter.com' in url for url in broken_links]):
16+
if all(['twitter.com' in url for url, _ in broken_links]):
1717
sys.exit(0)
1818
else:
1919
print('Broken links:', broken_links)

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Add any Sphinx extension module names here, as strings. They can be
1515
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
1616
# ones.
17-
extensions = []
17+
extensions = ["sphinx_design"]
1818

1919
# Add any paths that contain templates here, relative to this directory.
2020

docs/index.rst

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,21 @@ Matplotlib cheatsheets and handouts
77
Cheatsheets
88
***********
99

10-
.. container:: twocol
10+
.. grid:: 2
1111

12-
.. container::
12+
.. grid-item::
1313

14-
.. image:: ../cheatsheets-1.png
15-
:width: 270px
16-
:align: center
17-
:alt: image of first page of cheatsheets
14+
.. image:: ../cheatsheets-1.png
15+
:width: 270px
16+
:align: center
17+
:alt: image of first page of cheatsheets
1818

19+
.. grid-item::
1920

20-
.. container::
21-
22-
.. image:: ../cheatsheets-2.png
23-
:width: 270px
24-
:align: center
25-
:alt: image of second page of cheatsheets
26-
21+
.. image:: ../cheatsheets-2.png
22+
:width: 270px
23+
:align: center
24+
:alt: image of second page of cheatsheets
2725

2826
`Cheatsheets [pdf] <./cheatsheets.pdf>`_
2927

@@ -32,36 +30,34 @@ Cheatsheets
3230
Handouts
3331
********
3432

35-
.. container:: twocol
36-
37-
.. container::
38-
39-
.. image:: ../handout-beginner.png
40-
:width: 270px
41-
:align: center
42-
:alt: image of beginner handout
33+
.. grid:: 1 2 3 3
4334

44-
`Beginner [pdf] <./handout-beginner.pdf>`_
35+
.. grid-item::
4536

37+
.. image:: ../handout-beginner.png
38+
:width: 270px
39+
:align: center
40+
:alt: image of beginner handout
4641

47-
.. container::
42+
`Beginner [pdf] <./handout-beginner.pdf>`_
4843

49-
.. image:: ../handout-intermediate.png
50-
:width: 270px
51-
:align: center
52-
:alt: image of intermediate handout
44+
.. grid-item::
5345

54-
`Intermediate [pdf] <./handout-intermediate.pdf>`_
46+
.. image:: ../handout-intermediate.png
47+
:width: 270px
48+
:align: center
49+
:alt: image of intermediate handout
5550

51+
`Intermediate [pdf] <./handout-intermediate.pdf>`_
5652

57-
.. container::
53+
.. grid-item::
5854

59-
.. image:: ../handout-tips.png
60-
:width: 270px
61-
:align: center
62-
:alt: image of tips handout
55+
.. image:: ../handout-tips.png
56+
:width: 270px
57+
:align: center
58+
:alt: image of tips handout
6359

64-
`Tips [pdf] <./handout-tips.pdf>`_
60+
`Tips [pdf] <./handout-tips.pdf>`_
6561

6662
Contribute
6763
**********

0 commit comments

Comments
 (0)