Official Matplotlib cheat sheets

Overview

Cheatsheets

Handouts

How to compile

  1. You need to create a fonts repository with:

On Linux, with make installed, the fonts can be set up with the following command:

make -C fonts

The fonts can be made discoverable by matplotlib (through fontconfig) by creating the following in $HOME/.config/fontconfig/fonts.conf (see here):

/path/to/cheatsheets/fonts/ ... ">
xml version="1.0"?>
DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/path/to/cheatsheets/fonts/dir>
...
fontconfig>
  1. You need to generate all the figures:
$ cd scripts
$ for script in *.py; do python $script; done
$ cd ..
  1. Compile the sheet
$ xelatex cheatsheets.tex
$ xelatex cheatsheets.tex
Comments
  • Issue with build process

    Issue with build process

    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.

    opened by btharbaugh 14
  • Automatic building of the PDF and the PNG files

    Automatic building of the PDF and the PNG files

    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.

    opened by rougier 13
  • update selection of interpolation methods

    update selection of interpolation methods

    Attempts to address #28.

    • replace 'none' with blackman

    Something else to consider would be making the image data the same as what is used in the current matplotlib gallery example for the interpolation methods. To that effect, I could add a commit to this PR.

    opened by jimustafa 10
  • Automatically generated logo for the cheatsheets

    Automatically generated logo for the cheatsheets

    As has been discussed in #32, there is a need to keep the matplotlib logo in the cheatsheets up to date with the correct version in the tag line. This PR does a couple of things:

    • upgrades and pins the matplotlib version, updates the dependencies, and simplifies the requirements specification
    • adds a script for generating the matplotlib logo, originally written by @timhoffm
    • modifies the script to include "Cheat sheets" and the matplotlib version in the tag line

    There may be some small tweaks to make the logo more closely resemble the one by @rougier; well, maybe also a big tweak, as the font is currently Carlito, not Calibri.

    opened by jimustafa 10
  • cheatsheets-2.png shows interpolation different for none vs None

    cheatsheets-2.png shows interpolation different for none vs None

    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:

    interpolations.pdf

    which has the correct top row.

    The image in the repo should be updated.

    opened by zingale 8
  • add candlestick cheat .

    add candlestick cheat .

    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

    opened by mablue 6
  • Simplifying code

    Simplifying code

    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.

    opened by Atcold 6
  • Missing name style

    Missing name style

    Thanks for the great cheatsheets!

    The first page in Matplotlib cheatsheets, chart "style name" missing in "Style" - plot (2,1), that looks like "ggplot"

    opened by fgomezdelarosa 6
  • cmap() can be called on array-like

    cmap() can be called on array-like

    No need for a list comprehension; just call cmap(list).

    Also, use Oranges colormap instead of Blues because the illustrative image is in orange and using Blues is slightly confusing then.

    opened by timhoffm 6
  • Update for version 3.5.0

    Update for version 3.5.0

    • make room for two additional annotation arrow styles (so that 'wedge' is show again)
    • add possibility to set tick labels together with tick positions
    opened by StefRe 5
  • Update Color Names plot

    Update Color Names plot

    • add default color cycler colors (C0 ... C9)
    • group synomys (e.g. black, k or aqua, cyan), combining gray and grey into gr[ae]y to save space
    • some minor flake8 fixes

    I think it's essential to show the default color cycler colors in this plot too. In order to not reduce the size of the color patches I've put color name synonyms together and combined the various ...gray/...grey names to ...gr[ae]y much in the same way as used elsewhere in this cheatsheet.

    opened by StefRe 5
  • Update for 3.6.0

    Update for 3.6.0

    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.

    opened by QuLogic 1
  • Clarify when to use None / np.nan to segement data

    Clarify when to use None / np.nan to segement data

    see https://github.com/matplotlib/matplotlib/issues/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.

    opened by tacaswell 2
  • Replace step with stairs and correct subplot_adjusts

    Replace step with stairs and correct subplot_adjusts

    Closes #109 Closes #111

    Hard to make the subplot_adjusts figure look really good, but here is the update one: image

    Stairs illustration: image

    (Both are screen shots of the PDF.)

    Not obvious which arguments should be used. I went with those that are (a bit) "special" for stairs.

    opened by oscargus 4
  • 'right' and 'top' in plt.subplots_adjust() are not directly padding size

    'right' and 'top' in plt.subplots_adjust() are not directly padding size

    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'.

    cheatsheet 
    opened by K-gihu 3
Owner
Matplotlib Developers
Matplotlib Developers
Peloton Stats to Google Sheets with Data Visualization through Seaborn and Plotly

Peloton Stats to Google Sheets with Data Visualization through Seaborn and Plotly Problem: 2 peloton users were looking for a way to track their metri

null 9 Jul 22, 2022
Cartopy - a cartographic python library with matplotlib support

Cartopy is a Python package designed to make drawing maps for data analysis and visualisation easy. Table of contents Overview Get in touch License an

null 1.2k Jan 1, 2023
Statistical data visualization using matplotlib

seaborn: statistical data visualization Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing

Michael Waskom 10.2k Dec 30, 2022
The windML framework provides an easy-to-use access to wind data sources within the Python world, building upon numpy, scipy, sklearn, and matplotlib. Renewable Wind Energy, Forecasting, Prediction

windml Build status : The importance of wind in smart grids with a large number of renewable energy resources is increasing. With the growing infrastr

Computational Intelligence Group 125 Dec 24, 2022
NorthPitch is a python soccer plotting library that sits on top of Matplotlib

NorthPitch is a python soccer plotting library that sits on top of Matplotlib.

Devin Pleuler 30 Feb 22, 2022
matplotlib: plotting with Python

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Check out our home page for more inform

Matplotlib Developers 16.7k Jan 8, 2023
Statistical data visualization using matplotlib

seaborn: statistical data visualization Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing

Michael Waskom 8.1k Feb 13, 2021
:small_red_triangle: Ternary plotting library for python with matplotlib

python-ternary This is a plotting library for use with matplotlib to make ternary plots plots in the two dimensional simplex projected onto a two dime

Marc 611 Dec 29, 2022
Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:

JoyPy JoyPy is a one-function Python package based on matplotlib + pandas with a single purpose: drawing joyplots (a.k.a. ridgeline plots). The code f

Leonardo Taccari 462 Jan 2, 2023
A python package for animating plots build on matplotlib.

animatplot A python package for making interactive as well as animated plots with matplotlib. Requires Python >= 3.5 Matplotlib >= 2.2 (because slider

Tyler Makaro 394 Dec 18, 2022
matplotlib: plotting with Python

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Check out our home page for more inform

Matplotlib Developers 13.1k Feb 18, 2021
Statistical data visualization using matplotlib

seaborn: statistical data visualization Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing

Michael Waskom 8.1k Feb 18, 2021
:small_red_triangle: Ternary plotting library for python with matplotlib

python-ternary This is a plotting library for use with matplotlib to make ternary plots plots in the two dimensional simplex projected onto a two dime

Marc 391 Feb 17, 2021
Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:

JoyPy JoyPy is a one-function Python package based on matplotlib + pandas with a single purpose: drawing joyplots (a.k.a. ridgeline plots). The code f

Leonardo Taccari 317 Feb 17, 2021
A python package for animating plots build on matplotlib.

animatplot A python package for making interactive as well as animated plots with matplotlib. Requires Python >= 3.5 Matplotlib >= 2.2 (because slider

Tyler Makaro 356 Feb 16, 2021
Painlessly create beautiful matplotlib plots.

Announcement Thank you to everyone who has used prettyplotlib and made it what it is today! Unfortunately, I no longer have the bandwidth to maintain

Olga Botvinnik 1.6k Jan 6, 2023
basemap - Plot on map projections (with coastlines and political boundaries) using matplotlib.

Basemap Plot on map projections (with coastlines and political boundaries) using matplotlib. ⚠️ Warning: this package is being deprecated in favour of

Matplotlib Developers 706 Dec 28, 2022
Easily convert matplotlib plots from Python into interactive Leaflet web maps.

mplleaflet mplleaflet is a Python library that converts a matplotlib plot into a webpage containing a pannable, zoomable Leaflet map. It can also embe

Jacob Wasserman 502 Dec 28, 2022
Design your own matplotlib stylefile interactively

Tired of playing with font sizes and other matplotlib parameters every time you start a new project or write a new plotting function? Want all you plots have the same style? Use matplotlib configuration files!

yobi byte 207 Dec 8, 2022