API reference

Top-level functions

The starting point for creating custom ProPlot figures.

close(*args, **kwargs)

Call matplotlib.pyplot.close.

show(*args, **kwargs)

Call matplotlib.pyplot.show.

subplots([array, ncols, nrows, ref, order, …])

Create a figure with a single subplot or arbitrary grids of subplots, analogous to matplotlib.pyplot.subplots.

SubplotsContainer([iterable, n, order])

List subclass and pseudo-2d array used as a container for the axes returned by subplots.

Figure class

The figure class used for all ProPlot figures.

Figure([tight, ref, pad, axpad, panelpad, …])

The Figure class returned by subplots.

Axes classes

The axes classes used for all ProPlot figures.

Axes(*args[, number, main])

Lowest-level axes subclass.

CartesianAxes(*args, **kwargs)

Axes subclass for plotting in ordinary Cartesian coordinates.

PolarAxes(*args, **kwargs)

Axes subclass for plotting in polar coordinates.

GeoAxes(*args, **kwargs)

Axes subclass for plotting on cartographic projections.

CartopyAxes(*args[, autoextent, map_projection])

Axes subclass for plotting cartopy projections.

BasemapAxes(*args[, map_projection])

Axes subclass for plotting basemap projections.

Constructor functions

The constructor functions used to build class instances from simple shorthand arguments.

Colormap(*args[, name, listmode, samples, …])

Generate, retrieve, modify, and/or merge instances of PerceptuallyUniformColormap, LinearSegmentedColormap, and ListedColormap.

Colors(*args, **kwargs)

Pass all arguments to Cycle and return the list of colors from the resulting Cycler object.

Cycle(*args[, N, samples, name, marker, …])

Generate and merge Cycler instances in a variety of ways.

Norm(norm, *args, **kwargs)

Return an arbitrary Normalize instance.

Formatter(formatter, *args[, date, index])

Return a Formatter instance.

Locator(locator, *args, **kwargs)

Return a Locator instance.

Scale(scale, *args, **kwargs)

Return a ScaleBase instance.

Proj(name[, basemap])

Return a cartopy.crs.Projection or Basemap instance.

Configuration tools

Tools for setting up ProPlot and configuring global settings. See the configuration guide for details.

rc

Instance of RcConfigurator.

RcConfigurator([local, user, default])

Magical abstract class for managing matplotlib’s builtin settings and ProPlot’s added settings.When ProPlot is imported, this class is instantiated as the rc object and the ProPlot default settings and .proplotrc user overrides are applied.To modify these settings, use the rc object.See the configuration guide for details..

register_cmaps([user, default])

Register colormaps packaged with ProPlot or saved to the ~/.proplot/cmaps folder.

register_cycles([user, default])

Register color cycles packaged with ProPlot or saved to the ~/.proplot/cycles folder.

register_colors([user, default, space, margin])

Register the open-color colors, XKCD color survey colors, and colors saved to the ~/.proplot/colors folder.This is called on import.The color survey colors are filtered to a subset that is “perceptually distinct” in the HCL colorspace.The user color names are loaded from .txt files saved in ~/.proplot/colors.Each file should contain one line per color in the format name : hex.Whitespace is ignored..

register_fonts()

Add fonts packaged with ProPlot or saved to the ~/.proplot/fonts folder, if they are not already added.

config_inline_backend([fmt])

Set up the ipython inline backend format and ensure that inline figures always look the same as saved figures.

use_style(style)

Apply the matplotlib style(s) with matplotlib.style.use.

Plotting wrappers

The plotting wrappers that add functionality to various Axes methods. “Wrapped” Axes methods accept the additional keyword arguments documented by the wrapper function. In a future version, these features will be documented on the individual Axes methods themselves.

bar_wrapper(self, func[, x, height, width, …])

Supports grouping and stacking successive columns of data, and changes the default bar style.

barh_wrapper(self, func[, y, right, width, left])

Supports grouping and stacking successive columns of data, and changes the default bar style.

boxplot_wrapper(self, func, *args[, color, …])

Adds convenient keyword arguments and changes the default boxplot style.

cmap_changer(self, func, *args[, extend, …])

Adds several new keyword args and features for specifying the colormap, levels, and normalizers.

colorbar_wrapper(self, mappable[, values, …])

Adds useful features for controlling colorbars.

cycle_changer(self, func, *args[, cycle, …])

Adds features for controlling colors in the property cycler and drawing legends or colorbars in one go.

default_latlon(self, func, *args[, latlon])

Makes latlon=True the default for basemap plots.

default_transform(self, func, *args[, transform])

Makes transform=cartopy.crs.PlateCarree() the default for cartopy plots.

fill_between_wrapper(self, func, *args, **kwargs)

Supports overlaying and stacking successive columns of data, and permits using different colors for “negative” and “positive” regions.

fill_betweenx_wrapper(self, func, *args, …)

Supports overlaying and stacking successive columns of data, and permits using different colors for “negative” and “positive” regions.

hlines_wrapper(self, func, *args, **kwargs)

Plot horizontal lines with flexible positional arguments and optionally use different colors for “negative” and “positive” lines.

indicate_error(self, func, *args[, medians, …])

Adds support for drawing error bars and error shading on-the-fly.

legend_wrapper(self[, handles, labels, …])

Adds useful features for controlling legends, including “centered-row” legends.

scatter_wrapper(self, func, *args[, s, …])

Adds keyword arguments to scatter that are more consistent with the plot keyword arguments and supports cmap_changer features.

standardize_1d(self, func, *args[, autoformat])

Interpret positional arguments for the “1D” plotting methods so usage is consistent.

standardize_2d(self, func, *args[, …])

Interpret positional arguments for the “2D” plotting methods so usage is consistent.

text_wrapper(self, func[, x, y, text, …])

Enables specifying tranform with a string name and adds a feature for drawing borders around text.

violinplot_wrapper(self, func, *args[, lw, …])

Adds convenient keyword arguments and changes the default violinplot style to match this matplotlib example.

vlines_wrapper(self, func, *args, **kwargs)

Plot vertical lines with flexible positional arguments and optionally use different colors for “negative” and “positive” lines.

Demo functions

Functions for enumerating and contrasting the available colors and fonts.

show_cmaps(*args, **kwargs)

Generate a table of the registered colormaps or the input colormaps categorized by source.

show_channels(*args[, N, saturation, rgb, …])

Show how arbitrary colormap(s) vary with respect to the hue, chroma, luminance, HSL saturation, and HPL saturation channels, and optionally the red, blue and green channels.

show_colors(*[, nhues, minsat, categories, …])

Generate tables of the registered color names.

show_colorspaces(*[, luminance, saturation, …])

Generate hue-saturation, hue-luminance, and luminance-saturation cross-sections for the HCL, HSL, and HPL colorspaces.

show_cycles(*args, **kwargs)

Generate a table of registered color cycles or the input color cycles categorized by source.

show_fonts(*args[, family, text, size, …])

Generate a table of fonts.

Colormaps and normalizers

New colormap classes and colormap normalization classes.

make_mapping_array(N, data[, gamma, inverse])

Similar to makeMappingArray but permits circular hue gradations along 0-360, disables clipping of out-of-bounds channel values, and uses fancier “gamma” scaling.

ListedColormap(*args[, alpha])

New base class for all ListedColormaps.

LinearSegmentedColormap(name, segmentdata[, …])

New base class for all LinearSegmentedColormaps.

PerceptuallyUniformColormap(name, segmentdata)

Similar to LinearSegmentedColormap, but instead of varying the RGB channels, we vary hue, saturation, and luminance in either the HCL colorspace or the HSL or HPL scalings of HCL.

DiscreteNorm(levels[, norm, step, extend, …])

Meta-normalizer that discretizes the possible color values returned by arbitrary continuous normalizers given a list of level boundaries.

DivergingNorm([vcenter, vmin, vmax, fair, clip])

Normalizer that ensures some central data value lies at the central colormap color.

LinearSegmentedNorm(levels[, vmin, vmax, clip])

Normalizer that scales data linearly with respect to average position in an arbitrary monotonically increasing level lists.

ColorDatabase(mapping)

Dictionary subclass used to replace the builtin matplotlib color database.

ColormapDatabase(kwargs)

Dictionary subclass used to replace the matplotlib.cm.cmap_d colormap dictionary.

Locators and formatters

Various Locator and Formatter classes.

AutoFormatter([zerotrim, tickrange, …])

The new default formatter.

FracFormatter([symbol, number])

Format numbers as fractions or multiples of some arbitrary value.

LongitudeLocator(*args, **kwargs)

A locator for determining longitude gridlines.

LatitudeLocator(*args, **kwargs)

A locator for determining latitude gridlines.

SciFormatter([precision, zerotrim])

Format numbers with scientific notation.

SigFigFormatter([sigfig, zerotrim])

Rounds numbers to the specified number of significant digits.

SimpleFormatter([precision, zerotrim, …])

Replicate various features from AutoFormatter.

Axis scale classes

Various axis ScaleBase classes.

CutoffScale(*args)

Axis scale composed of arbitrary piecewise linear transformations.

ExpScale([a, b, c, inverse])

“Exponential scale” that performs either of two transformations.

FuncScale(arg[, invert, parent_scale, …])

An axis scale comprised of arbitrary forward and inverse transformations.

InverseScale()

Axis scale that is linear in the inverse of x.

LinearScale(**kwargs)

As with LinearScale but with AutoFormatter as the default major formatter.

LogitScale(**kwargs)

As with LogitScale but with AutoFormatter as the default major formatter.

LogScale(**kwargs)

As with LogScale but with AutoFormatter as the default major formatter.

MercatorLatitudeScale([thresh])

Axis scale that transforms coordinates as with latitude in the Mercator projection.

PowerScale([power, inverse])

“Power scale” that performs the transformation

SineLatitudeScale()

Axis scale that is linear in the sine of x.

SymmetricalLogScale(**kwargs)

As with SymmetricalLogScale but with AutoFormatter as the default major formatter.

Cartopy projections

New cartopy projection classes.

Aitoff([central_longitude, globe, …])

The Aitoff projection.

Hammer([central_longitude, globe, …])

The Hammer projection.

KavrayskiyVII([central_longitude, globe, …])

The Kavrayskiy VII projection.

NorthPolarAzimuthalEquidistant([…])

Analogous to NorthPolarStereo.

NorthPolarGnomonic([central_longitude, globe])

Analogous to NorthPolarStereo.

NorthPolarLambertAzimuthalEqualArea([…])

Analogous to NorthPolarStereo.

SouthPolarAzimuthalEquidistant([…])

Analogous to SouthPolarStereo.

SouthPolarGnomonic([central_longitude, globe])

Analogous to SouthPolarStereo.

SouthPolarLambertAzimuthalEqualArea([…])

Analogous to SouthPolarStereo.

WinkelTripel([central_longitude, globe, …])

The Winkel tripel (Winkel III) projection.

Gridspec classes

The new gridspec classes.

GridSpec(figure[, nrows, ncols])

Matplotlib GridSpec subclass that allows for grids with variable spacing between successive rows and columns of axes.

SubplotSpec(gridspec, num1[, num2])

Matplotlib SubplotSpec subclass that adds some helpful methods.

Miscellaneous tools

Various tools that may be useful while making plots.

arange(min_, *args)

Identical to numpy.arange but with inclusive endpoints.

edges(Z[, axis])

Calculate the approximate “edge” values along an axis given “center” values.

edges2d(Z)

Calculate the approximate “edge” values given a 2d grid of “center” values.

units(value[, dest, axes, figure, width])

Convert values and lists of values between arbitrary physical units.

set_alpha(color, alpha)

Return a color with the opacity channel set to the specified value.

set_hue(color, hue[, space])

Return a color with a different hue and the same luminance and saturation as the input color.

set_luminance(color, luminance[, space])

Return a color with a different luminance and the same hue and saturation as the input color.

set_saturation(color, saturation[, space])

Return a color with a different saturation and the same hue and luminance as the input color.

scale_luminance(color[, scale, space])

Scale the luminance channel of a color.

scale_saturation(color[, scale, space])

Scale the saturation channel of a color.

to_rgb(color[, space, cycle])

Translate the color in any format and from any colorspace to an RGB tuple.

to_xyz(color[, space])

Translate color in any format to a tuple of channel values in any colorspace.

to_rgba(color[, space, cycle])

Translate the color in any format and from any colorspace to an RGB tuple.

to_xyza(color[, space])

Translate color in any format to a tuple of channel values in any colorspace.