Overview of ProPlot
mastermatplotlib designed to facilitate the creation of beautiful, publication-quality graphics. It simplifies the complex API of matplotlib to provide a more streamlined workflow for scientific plotting.repository·master·Indexed 22 days ago
https://github.com/proplot-dev/proplotA succinct matplotlib wrapper for creating publication-quality graphics. It provides specialized subclasses of matplotlib.figure.Figure and matplotlib.axes.Axes, a comprehensive configuration system via proplot.config.rc, and integrated support for geophysical plotting and custom colormaps. Note: development is currently halted; users are encouraged to use its successor, Ultraplot.
matplotlib designed to facilitate the creation of beautiful, publication-quality graphics. It simplifies the complex API of matplotlib to provide a more streamlined workflow for scientific plotting.proplot has been indefinitely halted since summer 2023. For a modernized version that supports recent versions of matplotlib, cartopy, and python, use Ultraplot, which is the spiritual successor to proplot.Proplot provides specialized colormap classes and automatic handling:
proplot.colors.ContinuousColormap (formerly LinearSegmentedColormap)proplot.colors.PerceptualColormap (formerly PerceptuallyUniformColormap)proplot.colors.DiscreteColormap (formerly ListedColormap)cmap.autodiverging is enabled, Proplot automatically applies proplot.colors.DivergingNorm based on input data when a diverging colormap is detected.robust keyword argument (or cmap.robust setting) to ignore outliers when selecting colormap ranges. It accepts True, a percentile range, or a 2-tuple percentile interval.colors=colors or qualitative=True triggers special qualitative colormap handling using DiscreteNorm.Proplot has built-in support for physical units and data structures:
pint.Quantity arguments automatically applies setup_matplotlib with the quantity's unit registry. You can also use proplot.utils.units(num, 'in', 'cm') for manual conversion.xarray.DataArray arguments. It automatically accesses the .data attribute rather than .values to preserve metadata and units.unitformat setting to control how pint.Quantity default unit labels are formatted on plots.proplot.ticker.DiscreteLocator. This is used for major/minor discrete colorbar ticks and automatically updates tick selection whenever the axes are drawn. It is an alternative to matplotlib's FixedLocator that allows ticking from a subset of fixed values. You can also register it as 'discrete' in proplot.constructor.Locator.Proplot replaces Matplotlib's relative figure/axes units with a physical units engine (proplot.utils.units), allowing for more intuitive layout control.
The following proplot.gridspec.GridSpec keywords accept physical units:
left, right, top, bottomwspace, hspacepad, outerpad, innerpadBy default, numeric arguments are treated as em-widths.
The following proplot.figure.Figure keywords accept physical units:
figsize, figwidth, figheight, refwidth, refheightAcceptable units include:
inchescentimetersmillimeterspixelspointspicasProplot also translates these units when assigned to proplot.config.rc_matplotlib and proplot.config.rc_proplot settings (e.g., subplots.refwidth, legend.columnspacing, axes.labelpad).
Proplot provides tools to manage and display colormaps and color cycles:
proplot.styletools.LinearSegmentedColormap.from_file. You can also pass a name directly to proplot.styletools.Colormap to load it._shifted to its name (e.g., 'viridis_shifted'), similar to the matplotlib _r suffix.proplot.styletools.show_cmaps and proplot.styletools.show_cycles to visualize available colormaps and color cycles. In newer versions, these display using colorbars rather than lines.In Proplot versions 0.8.0 and later, many former top-level 'wrapper' functions have been moved directly onto the proplot.axes.PlotAxes class.
Instead of using standalone functions like standardize_1d or cmap_changer, you should use the corresponding methods on your axes object (e.g., ax.plot() or ax.pcolor()).
Proplot provides a unified proplot.config.rc object to manage both native matplotlib settings (via proplot.config.rc_matplotlib) and additional proplot-specific settings (via proplot.config.rc_proplot).
meta.edgecolor, meta.linewidth, and font.smallsize.proplot.config.Configurator.save (check proplot.config.Configurator.changed to see what has been modified) and load settings using proplot.config.Configurator.load.You can modify settings using several methods:
pplt.rc.key = value or pplt.rc[key] = valuepplt.rc.update(key=value)proplot.axes.Axes.formatproplot.config.Configurator.contextimport proplot as pplt
# Direct assignment
pplt.rc.font.size = 12
# Bulk update
pplt.rc.update(font.size=12, axes.linewidth=1.5)
# Using meta settings to update multiple properties
pplt.rc.meta.edgecolor = 'red'
pplt.rc.meta.linewidth = 2Proplot axes are subclasses of proplot.axes.PlotAxes. Depending on the coordinate system required, they fall into one of three main categories:
proplot.axes.CartesianAxes: For standard plots with x and y coordinates.proplot.axes.GeoAxes: For geographic plots using longitude and latitude coordinates.proplot.axes.PolarAxes: For polar plots using azimuth and radius coordinates.Most proplot features are implemented through these subclasses, providing enhanced functionality to standard plotting commands like .plot(), .scatter(), .bar(), .area(), .box(), .violin(), .contour(), .pcolor(), and .imshow().
Proplot is not a standalone library used separately from Matplotlib; instead, it is built directly into the Matplotlib API. It achieves this by providing specialized subclasses of:
matplotlib.figure.Figurematplotlib.axes.AxesThis allows users to leverage Proplot's enhanced features (like improved layout algorithms and specialized formatting) while remaining within the standard Matplotlib ecosystem.
Proplot provides native support for scientific data containers like xarray.DataArray, pandas.DataFrame, pandas.Series, and pint.Quantity. Unlike standard Matplotlib, Proplot automatically extracts metadata from these objects to populate axis labels, tick labels, subplot titles, colorbar labels, and legend labels.
Key features include:
pint.Quantity objects, Proplot automatically generates unit strings based on the unitformat setting. It also handles pint.UnitRegistry.setup_matplotlib automatically for $x$ and $y$ coordinates.proplot.axes.PlotAxes commands.colorbar and legend keywords for automatic guide placement.You can disable this automatic behavior by setting autoformat=False in the global configuration or by passing autoformat=False as a keyword argument to any plotting command.