matplotlib / cheatsheets Goto Github PK
View Code? Open in Web Editor NEWOfficial Matplotlib cheat sheets
Home Page: https://matplotlib.org/cheatsheets/
License: BSD 2-Clause "Simplified" License
Official Matplotlib cheat sheets
Home Page: https://matplotlib.org/cheatsheets/
License: BSD 2-Clause "Simplified" License
Based on #80 (comment), there may be an opportunity to reduce the number of image interpolation methods that are demonstrated, and make room for new material.
BSD ?
Website: https://matplotlib.org/cheatsheets/
The website is currently contains only plain HTML.
It would be better if we can make it look more like the official site: https://matplotlib.org/stable/index.html
Line 215 in 329e0ba
tight_layout
in particular. Is there a reason to not also call out constrained_layout
? In general constrained_layout
is more "automatic".In the beginner handout, there is a brief section on how to display a given plot
I wanted to start a small discussion on whether the call to fig.show()
should be replaced by plt.show
.
Since this is a beginner cheatsheet, the management of a blocking GUI loop is slightly out-of-scope. fig.show
does not manage this loop (whereas plt.show
does), new users may wonder why their plot disappears as quickly as it appears when using fig.show
.
If you look at the imagine cheatsheets-2.png linked in the README.md:
https://github.com/matplotlib/cheatsheets/blob/master/cheatsheets-2.png
in the interpolations image grid, the "none" version actually is using some sort of interpolation. This makes it seem like "none"
and None
are different, but they should not be.
When I run the interpolations.py
script locally
(https://github.com/matplotlib/cheatsheets/blob/master/scripts/interpolations.py) I get the following:
which has the correct top row.
The image in the repo should be updated.
@jimustafa what was the reason for pinning cartopy to 0.19.0.post1
in dbf92ab? It seems to work with any (newer) version too.
This requires updating the Sphinx theme (e.g. matplotlib/mpl-third-party#134), but also auditing the plots to make sure they did not break or could be using newer stuff.
So that we have a nice target to point browsers to with links to the pdf and back to github.
This can probably be a static html page (not generated from sphinx).
I think some closing parenthesis are missing in the beginners handout:
https://raw.githubusercontent.com/matplotlib/cheatsheets/master/handout-beginner.png
When np.random.uniform()
is used with the size argument as a tuple, the last closing parenthesis is missing.
Thanks for publishing this cheatsheet. I learned about several features while reading through it.
In the Lines section, the example of using a dash tuple for linestyle
is missing the closing parenthesis. I tried running your linestyles.py
script, and it shows the closing parenthesis, so I guess it gets cropped when you assemble the whole thing in LaTeX.
Another minor suggestion: remove the /matplotlib
from the end of the Stack Overflow help item, because it's not a valid URL. The PDF version of the cheatsheet has the full /questions/tagged/matplotlib
in the link, but the PNG version might confuse people who try to type it in as listed.
Latex code is a bit messy, it would need some cleanup
Capitalization of section titles switches between all words starting with capital letters and only the first word starting with a capital letter; e.g.
Choose one way and stick with it throughout.
Note: The Matplotlib docs only capitalize the first word of a section. I don't care if the cheat sheets use the same rule, as long as they are consistent within themselves.
I can compile the tex document with the font specs commented out.
However, with the fonts defined as in the document, e.g
\setmainfont{Source Serif Pro}[
Path = fonts/source-serif-pro/SourceSerifPro-, Extension = .otf,
UprightFont= Light,
ItalicFont = LightIt,
BoldFont = Regular,
BoldItalicFont = It]
it is looking for fonts that do not exist. E.g.
fonts/source-serif-pro/SourceSerifPro-Light.otf
is not part of any of the linked google font sets.
In the last paragraph we read documenation
instead of documentation
...
The cheatsheets that are automatically built should be available here, but I am getting a 404
. If GH Pages has not been activated for the repo, that could be the cause. There may also be a problem with the project pages and having a custom domain for the organization pages, as discussed in isaacs/github#547.
Most, if not all, np.
, plt.
, ax.
, fig.
, and mpl.
can be safely removed if importing *
directly in the main name namespace. Currently there are so many useless repetitions, IMHO.
from matplotpib.pylab import *
would make things much cleaner and simple.
Line 721 in af15065
This should become plt.\textbf{tight\_layout}()\\
There are a couple of broken links in the navigation bar for the cheatsheets site https://matplotlib.org/cheatsheets, specifically the "Plot types" and "Release notes" links. Once current matplotlib dev version is released and the docs are published to https://matplotlib.org/stable, this would not be an issue; still, probably should be addressed.
Also, the search bar is a bit unnecessary, as it does not search the main site. Can the sidebar from the main site be integrated into the cheatsheets site. Or, maybe it is better to build the cheatsheets site in the matplotlib docs.
see matplotlib/matplotlib#23714
These is some user confusion about when to use ax.plot
with np.nan
separated data and when something like LineCollection
is a better choice. In particular, using the segmented data approach the line will be drawn as a single path which will not show self-intersection for alpha < 1.
handout-intermediate.pdf, "Lines & markers"
Given X of length 1000, the plot with markevery=25 should mark 1000/25 = 40 points, but there are 20 of them on the figure, so it seems a bug to me. (If so, it matters also to the next example, in "Scales & projections").
Hello,
thank you for this great summary. In handout-beginner.pdf
Y1, Y1 = np.sin(X), np.cos(X)
should be
Y1, Y2 = np.sin(X), np.cos(X)
bytelinker
I am attempting to build this repo with gitbash in Windows 10 pro. I have cloned the repo to a folder /git/cheatsheets and created /git/cheatsheets/fonts with all the required sub-folders as described in the README. However, when running the python scripts in the scripts directory I am getting a failure of
"findfont: Font family ['Source Code Pro'] not found. Falling back to DejaVu Sans."
I am guessing I have put the fonts folder in the wrong location and/or finding the fonts on the Windows file system is not working as expected.
Any help would be appreciated.
I'm using matplotlib-3.6.0.
When I use plt.subplots((2, 1)), there is an error: ValueError: Number of rows must be a positive integer, not (2, 1)
Folks should be usingpcolormesh
in general rather than imshow
- imshow really only works for equally spaced pixels, and there is lots of data that is not laid out that way. However the cheatsheet doesn't mention pcolormesh
.
Hello, congratulations on the work everyone has made so far.
I'm looking forwards to translate the cheatsheets to Spanish.
I've been told to open an issue to gather those who want to help, so here it is.
The cheatsheets comment the method "ax.set_[xy]ticks(rotation=90)
" to rotate ticks. However, it can cause confusion because the parameter "takes effect only if you pass labels"(official tutorial of ax.set_[xy]ticks()
. So this is a incomplete form and not recommended.
As the official tutorial says, I suggest ax.tick_params(axis='x', rotation=90)
.
Thanks for the great cheatsheets!
The first page in Matplotlib cheatsheets, chart "style name" missing in "Style" - plot (2,1), that looks like "ggplot"
Legend placement numbers in the cheatsheet are inconsistent with matplotlib documentation. (e.g. for lower-right, loc=3 in the cheatsheet instead of loc=4).
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.legend.html
It would be nice to have an automatic building of the PDF and PNG for each commit but I don't know if it is possible with e.g. Travis. It would require a partial TeXLive installation and I'm not sure how to setup.
Also, some have been manually post-processed with pdfcrop
(to remove white margin) and this should be automatized.
i dont know how to work, feel terrible
the most important thing on charting is finansal charts that matplotlib didnt work around it.
yes it have some libs and things but not sharply have do something for that.
please add cheatsheat for finansal and candlistic charts to help us thanks
Under Subplots layout
, the first argument is nrows
, second is ncols
Thanks for the great cheatsheets!
I think there is a missing )
in
Z = np.random.uniform(0, 1, (8, 8)
under Matplotlib for Beginners/Choose (both imshow
and contourf
).
Think there may be an error in your cheatsheet. The legend locations seem to be different than those in the matplotlib documentation:
Perhaps, we can use the GitHub Action or other CI/CD tools to automatically compile and release these beautiful and useful files.
Its license is not a common Free one, though that doesn't preclude it from being Free. However, before getting into those weeds, is it really needed? I don't see 'delicious' mentioned anywhere but the readme.
In many places we have uppercase variables, e.g.
X = np.linspace(0, 2 * np.pi, 100)
Y = np.sin(X)
and likewise then in the plot functions.
This is against PEP-8 naming conventions and IMHO sets a bad example. At least 1D arrays should be lowercase. One may debate on 2D arrays, which have a history of using uppercase letters in the Matplotlib docs.
Hey folks, do we want to enable branch protection? and do we want a certain # of reviews to merge stuff? attn: @rougier
Very thankful of the cheatsheet, but I think there's a little problem.
In 'Axes adjustments' of the second cheatsheet, 'right' directly refers to the padding between subplots' right edge and figure's right edge. However it actually refers to the relative distance between subplots' right edge and figure's left edge. The same also applies to 'top'.
As we execute /scripts/scales.py
, we have the following warning :
scales.py:27: MatplotlibDeprecationWarning: The 'basex' parameter of __init__() has been renamed 'base' since Matplotlib 3.3; support for the old name will be dropped two minor releases later.
ax.set_xscale("log", basex=10)
scales.py:39: MatplotlibDeprecationWarning: The 'basex' parameter of __init__() has been renamed 'base' since Matplotlib 3.3; support for the old name will be dropped two minor releases later.
ax.set_xscale("symlog", basex=10, linthreshx=1)
scales.py:39: MatplotlibDeprecationWarning: The 'linthreshx' parameter of __init__() has been renamed 'linthresh' since Matplotlib 3.3; support for the old name will be dropped two minor releases later.
ax.set_xscale("symlog", basex=10, linthreshx=1)
hello, there!
the PyLadies Brasil group is thinking about starting a Brazilian Portuguese translation of the cheatsheets and I wonder if there are specific guidelines for translations, i.e. where to save the translated files and so on, or if you are aware of any pt-br translation of this project that is ongoing.
if the answer is no for both questions, can we fork this repo and start? ๐
Otherwise, the GibHub page is quite undiscoverable in case somebody wants to contribute.
See the discussion in matplotlib/matplotlib#22277
To save time for beginners but still give chance to old hands
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.