ProPlot is an object-oriented matplotlib wrapper. The “wrapper” part means that
ProPlot’s features are largely a superset of matplotlib.
You can use your favorite plotting commands like
pcolor like you always have.
The “object-oriented” part means that ProPlot’s features are implemented with subclasses of the
If you tend to use
pyplot and are not familiar with figure and axes classes, check out this guide from the matplotlib documentation. Working with objects directly tends to be more clear and concise than
pyplot, makes things easier when working with multiple figures and axes, and is certainly more “pythonic”. Therefore, although some ProPlot features may still work, we do not officially support the
We recommend importing ProPlot as follows:
import proplot as plot
This differentiates ProPlot from the usual
plt abbreviation used for the
Importing proplot immediately adds a bunch of new colormaps, property cyclers, color names, and fonts to matplotlib. See Colormaps, Color cycles, and Colors and fonts for details.
Figure and axes classes¶
Making figures in ProPlot always begins with a call to the
import proplot as plot f, axs = plot.subplots(...)
subplots is modeled after
It creates an instance of ProPlot’s
populated with instances of ProPlot’s
See The basics
and Subplots features for details.
Axes returned by
belongs to one of the following three child classes:
XYAxes: For plotting simple data with x and y coordinates.
ProjAxes: For geographic plots with longitude and latitude coordinates.
PolarAxes: For polar plots with radius and azimuth coordinates.
See X and Y axis settings for details on working with
Geographic and polar plots for details on working with
Figure and axes methods¶
include several brand new methods and add to the functionality of several existing methods.
formatmethod is used to fine-tune various axes settings. Its behavior depends on whether the axes is an
ProjAxes. Think of this as a dedicated
updatemethod for axes artists. See Formatting subplots and Changing rc settings for details.
legendcommands are used to add colorbars and legends inside of subplots, along the outside edge of subplots, and along the edge of the figure. They considerably simplify the process of drawing colorbars and legends. See Colorbars and legends for details.
ProPlot adds a huge variety of features for working with
parametricplots. See 1d plotting and 2d plotting for details.
Integration with other packages¶
ProPlot’s features are integrated with the data containers
pandas and the
Axis labels, tick labels, titles, colorbar labels, and legend labels are automatically applied when you pass an
pandas.Seriesobject to any plotting command. This works just like the native
pandas.DataFrame.plotmethods. See 1d plotting and 2d plotting for details.
Projfunction lets you make arbitrary grids of basemap
Projectionprojections. It is used to interpret the
projkeyword arg passed to
subplots. The resulting axes are instances of
formatmethods that can be used to add geographic features and custom meridian and parallel gridlines. See Geographic and polar plots for details.
New functions and classes¶
ProPlot includes several useful constructor functions
and subclasses outside
Cycleconstructor functions can slice, merge, and modify colormaps and color cycles. See Colormaps, Color cycles, and Colors and fonts for details.
ListedColormapsubclasses replace the default matplotlib colormap classes and add several methods. The new
PerceptuallyUniformColormapclass is used to make colormaps with perceptually uniform transitions. See Colormaps for details.
show_colorspacesfunctions are used to visualize your color scheme and font options and inspect individual colormaps.
Normconstructor function generates colormap normalizers from shorthand names. The new
LinearSegmentedNormnormalizer scales colors evenly w.r.t. index for arbitrarily spaced monotonic levels, and the new
BinNormmeta-normalizer is used to discretized colormap colors. See 2d plotting for details.
Scaleconstructor functions, used to generate class instances from variable input types. These are used to interpret keyword arguments passed to
colorbar. See X and Y axis settings for details.
rcobject, an instance of
rc_configurator, is used for modifying individual global settings, changing settings in bulk, and temporarily changing settings in context blocks. You can also control settings with a
~/.proplotrcfile. See Configuring proplot for details.