A succinct matplotlib wrapper for making beautiful, publication-quality graphics.
npx @tessl/cli install tessl/pypi-proplot@0.9.0A succinct matplotlib wrapper for making beautiful, publication-quality graphics. Proplot provides enhanced functionality for creating scientific visualizations with less code and more intuitive syntax, including simplified subplot creation, automatic legend and colorbar placement, improved color and font handling, and seamless integration with cartopy and basemap for geographic plotting.
pip install proplot or conda install -c conda-forge proplotimport proplot as ppltAll public APIs are available at the top level:
import proplot as pplt
# Main functions for figure creation
fig, axes = pplt.subplots()
fig = pplt.figure()
# Display and close functions
pplt.show()
pplt.close()
# Configuration
pplt.rc['font.size'] = 12
# Utilities and constructors
cmap = pplt.Colormap('viridis')
colors = pplt.get_colors('tab10', 5)import proplot as pplt
import numpy as np
# Create sample data
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
# Create a simple plot with proplot
fig, ax = pplt.subplots(figsize=(8, 6))
ax.plot(x, y, color='red', linewidth=2)
ax.format(xlabel='X values', ylabel='Y values', title='Sine Wave')
pplt.show()
# Create subplots with enhanced grid layout
fig, axes = pplt.subplots(ncols=2, nrows=2, figwidth=10)
for i, ax in enumerate(axes):
ax.plot(x, np.sin(x + i*np.pi/4))
ax.format(title=f'Plot {i+1}')
fig.format(suptitle='Multiple Subplots')
pplt.show()
# Geographic plotting with cartopy integration
fig, ax = pplt.subplots(proj='robin')
ax.coastlines()
ax.format(title='World Map - Robinson Projection')
pplt.show()Proplot enhances matplotlib's architecture while maintaining full compatibility:
Core functionality for creating figures and subplot arrangements with enhanced grid layouts, automatic sizing, and publication-ready formatting options.
def figure(**kwargs):
"""
Create a proplot figure with enhanced features.
Parameters:
- figwidth (unit-spec): Figure width in physical units
- figheight (unit-spec): Figure height in physical units
- figsize (tuple): Figure size as (width, height) tuple
- journal (str): Preset journal size ('aaas1', 'agu1', 'nat1', etc.)
- tight (bool): Enable tight layout algorithm
- **kwargs: Additional figure parameters
Returns:
proplot.figure.Figure: Enhanced figure instance
"""
def subplots(*args, **kwargs):
"""
Create figure with subplots using proplot's enhanced grid system.
Parameters:
- nrows (int): Number of subplot rows (default: 1)
- ncols (int): Number of subplot columns (default: 1)
- array (array-like): 2D array specifying subplot arrangement
- proj (str): Map projection name for all subplots
- sharex (int/bool/str): X-axis sharing level (0-4)
- sharey (int/bool/str): Y-axis sharing level (0-4)
- share (int/bool/str): Both axes sharing level
- refwidth (unit-spec): Reference subplot width
- refheight (unit-spec): Reference subplot height
- **kwargs: Additional figure parameters
Returns:
tuple: (fig, axes) where fig is Figure and axes is SubplotGrid
"""
def show():
"""Display all open figures."""
def close(*args):
"""Close matplotlib figures."""
class Figure:
"""
Main proplot figure class with automatic layout management.
Enhanced matplotlib Figure with:
- Physical unit support for sizing
- Automatic layout management
- Built-in colorbar and legend placement
- Journal preset sizing
"""
class SubplotGrid:
"""
Container for proplot subplot axes with array-like indexing.
Provides iteration and bulk formatting capabilities.
"""Enhanced axes classes with extended formatting capabilities, seamless integration with multiple coordinate systems, and comprehensive plotting methods for scientific visualization.
class CartesianAxes:
"""Enhanced Cartesian coordinate axes with scientific formatting."""
class PolarAxes:
"""Polar coordinate axes with improved angular formatting."""
class GeoAxes:
"""Geographic projection axes with cartopy integration."""
class PlotAxes:
"""Mixin class providing enhanced plotting methods."""Centralized configuration system for managing matplotlib and proplot settings, including fonts, colors, sizes, and default behaviors across plotting sessions.
class Configurator:
"""Main configuration class for managing settings."""
rc: Configurator
"""Global configuration instance."""
rc_proplot: dict
"""Dictionary-like container of proplot settings."""
rc_matplotlib: dict
"""Dictionary-like container of matplotlib settings."""
def use_style(style):
"""Apply matplotlib styles."""
def config_inline_backend(fmt=None):
"""Set up ipython inline backend."""Advanced color handling system with perceptual color spaces, flexible colormap creation, enhanced color cycles, and seamless integration with matplotlib's color infrastructure.
class DiscreteColormap:
"""Replacement for matplotlib's ListedColormap with enhanced features."""
class ContinuousColormap:
"""Replacement for matplotlib's LinearSegmentedColormap."""
class PerceptualColormap:
"""Colormap with linear transitions across hue, saturation, luminance."""
def Colormap(*args, **kwargs):
"""Construct colormap instances from various inputs."""
def Cycle(*args, **kwargs):
"""Construct color cycle instances."""
def Norm(*args, **kwargs):
"""Construct color normalization instances."""
def get_colors(*args, **kwargs):
"""Get colors from registered or on-the-fly color cycle."""Comprehensive axis scaling system including logarithmic, power, inverse, and custom scales with seamless integration into matplotlib's transformation pipeline.
class CutoffScale:
"""Scale with arbitrary cutoff points."""
class ExpScale:
"""Exponential scale."""
class FuncScale:
"""Scale with arbitrary forward and inverse functions."""
class PowerScale:
"""Power scale."""
def Scale(*args, **kwargs):
"""Construct axis scale instances."""Advanced tick locator and formatter system with support for scientific notation, fractions, geographic coordinates, and custom number formatting patterns.
class AutoFormatter:
"""Automatic number formatting with flexible precision."""
class SciFormatter:
"""Format numbers with scientific notation."""
class DegreeFormatter:
"""Format numbers as geographic coordinates."""
def Locator(*args, **kwargs):
"""Construct tick locator instances."""
def Formatter(*args, **kwargs):
"""Construct tick formatter instances."""Extended collection of cartographic projections beyond matplotlib and cartopy defaults, with specialized polar projections and support for custom coordinate reference systems.
class Aitoff:
"""Aitoff projection."""
class Hammer:
"""Hammer projection."""
class WinkelTripel:
"""Winkel tripel (Winkel III) projection."""
def Proj(*args, **kwargs):
"""Construct projection instances."""Collection of utility functions for color manipulation, unit conversion, array operations, and data processing tasks commonly needed in scientific visualization workflows.
def arange(min_, *args):
"""Identical to numpy.arange but with inclusive endpoints."""
def edges(z, axis=-1):
"""Calculate edge values from center values along an axis."""
def units(value, **kwargs):
"""Convert between physical units."""
def set_hue(color, hue, space='hcl'):
"""Return color with different hue."""
def to_hex(color, **kwargs):
"""Translate color to HEX string."""Built-in functions for exploring and demonstrating proplot's capabilities, including colormap galleries, color space visualizations, and font collections.
def show_cmaps(*args, **kwargs):
"""Display available colormaps."""
def show_colors(*args, **kwargs):
"""Display available colors."""
def show_cycles(*args, **kwargs):
"""Display available color cycles."""
def show_fonts(*args, **kwargs):
"""Display available fonts."""This Knowledge Tile documents all public APIs from proplot v0.9.7, including 89+ classes, 50+ functions, and extensive customization options. All functionality is accessible through the top-level proplot import, maintaining full backward compatibility with matplotlib while providing enhanced scientific visualization capabilities.