matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.
matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. For a sampling, see the screenshots, thumbnail gallery, and examples directory
For the power user, you have full control of line styles, font properties, axes properties, etc, via an object oriented interface or via a set of functions familiar to MATLAB users.
Most examples in this documentation should "just work" in Pythonista, interactive charts (with GUI) and animation are not supported though.
Please note that matplotlib can be somewhat slow on an iOS device. It usually takes around 10 seconds for the first plot to show up, though it should be faster afterwards (a few seconds are still common, even for simple plots).
Another thing you should be aware of is that the pyplot module relies a lot on global state. Since Pythonista runs scripts in a single interpreter that exists for the entire runtime of the app, this would normally mean that running a script repeatedly might lead to undesirable behavior (e.g. adding lines to the plot each time, instead of creating a new plot). When you have the "Clear Global Variables" setting enabled however (the default), Pythonista tries to clear the current plot using plt.clf()
when you run a script, so in most cases you should still get the expected result.
Pythonista only supports the default 'Agg' backend, which is usually non-interactive, but Pythonista's version includes a custom show
method, so that plots can be displayed in the console without having to save an image file manually.
On August 28 2012, John D. Hunter, the creator of matplotlib, died from complications arising from cancer treatment, after a brief but intense battle with this terrible illness. John is survived by his wife Miriam, his three daughters Rahel, Ava and Clara, his sisters Layne and Mary, and his mother Sarah. If you have benefited from John's many contributions, please say thanks in the way that would matter most to him. Please consider making a donation to the John Hunter Memorial Fund. |
Trying to learn how to do a particular kind of plot? Check out the gallery, examples, or the list of plotting commands.
matplotlib is a welcoming, inclusive project, and we try to follow the Python Software Foundation Code of Conduct in everything we do.
Check the faq, the api docs, mailing list archives, and join the matplotlib mailing lists. Check out the matplotlib questions on stackoverflow. The search tool searches all of the documentation, including full text search of over 350 complete examples which exercise almost every corner of matplotlib.
You can file bugs, patches and feature requests on the github tracker, but it is a good idea to ping us on the mailing list too.
To keep up to date with what's going on in matplotlib, see the what's new page, the more detailed changelog or browse the source code. Anything that could require changes to your existing code is logged in the api changes file.
There are several matplotlib add-on toolkits, including a choice of two projection and mapping toolkits basemap and cartopy, 3d plotting with mplot3d, axes and axis helpers in axes_grid and more.
matplotlib is the brainchild of John Hunter (1968-2012), who, along with its many contributors, have put an immeasurable amount of time and effort into producing a piece of software utilized by thousands of scientists worldwide. If matplotlib contributes to a project that leads to a scientific publication, please acknowledge this work by citing the project. You can use this ready-made citation entry.
Please consider donating to support matplotlib development or to the John Hunter Memorial Fund.
The matplotlib license is based on the Python Software Foundation (PSF) license.
There is an active developer community and a long list of people who have made significant contributions.