API reference
The plotting defaults are set up such that the user is not expected to modify them in order to get publication-ready plots. However, because there is no “right way” to make a figure, it is impossible to create a set of defaults that satisfy everyone. These defaults are made accessible so that users can easily modify the figures in a single location, if desired.
These defaults are provided as immutable dataclasses and are intended to:
Ensure consistent visual styling across plots
Provide sensible, publication-ready defaults
Allow users to override behavior in a controlled and explicit way
- class ampy.defaults.plotting.BandColorMap(colors=<factory>, aliases=<factory>, default='black')
Bases:
objectDefault color mapping for photometric bands.
This class maps band or filter names to colors used when plotting photometric data. It also supports alias names that map to canonical band identifiers.
- colors: Mapping[str, str]
- aliases: Mapping[str, str]
- default: str
Fallback color used when a band is not recognized.
- get(band)
Return the plotting color for a given band name.
- Parameters:
band (str) – Band or filter identifier.
- Returns:
Color associated with the band. If the band is unknown, the default color is returned.
- Return type:
str
- class ampy.defaults.plotting.CornerPlotDefaults(label_size=16, show_titles=True, color='mediumblue', plot_datapoints=False, quantiles=(0.16, 0.5, 0.84), label_kwargs=<factory>, title_kwargs=<factory>, fill_contours=True, smooth=0.7, smooth1d=0.7)
Bases:
objectDefault configuration for corner plots.
This class defines the default keyword arguments passed to
corner.corner()when visualizing posterior samples.- label_size: int
Base label size used by the corner plot (if supported by the caller).
- show_titles: bool
Whether to show summary statistics in titles on the diagonal.
- color: str
Primary contour/line color used for the corner plot.
- plot_datapoints: bool
Whether to draw individual sample points (can be slow/overplotted).
- quantiles: tuple[float, float, float]
Quantiles shown in titles (e.g., 16th/50th/84th percentiles).
- label_kwargs: dict[str, Any]
Keyword arguments forwarded to label text creation.
- title_kwargs: dict[str, Any]
Keyword arguments forwarded to title text creation.
- fill_contours: bool
Whether to fill contour levels.
- smooth: float
Smoothing applied to 2D histograms (KDE-ish; see
cornerdocs).
- smooth1d: float
Smoothing applied to 1D histograms (diagonal panels).
- kwargs()
Return keyword arguments compatible with
corner.corner().- Returns:
Suitable for unpacking into
corner.corner(..., **kwargs).- Return type:
dict
- class ampy.defaults.plotting.ObservedIndexStyle(fmt='o', linestyle='none', capsize=3.0, color='black', zorder=999)
Bases:
objectDefault styling for observed spectral index points.
This class defines the default keyword arguments passed to
matplotlib.axes.Axes.errorbar()when plotting observed spectral indices.- fmt: str
Marker style used for the observed points.
- linestyle: str
Line style connecting points (typically disabled).
- capsize: float
Size of the error bar caps, in points.
- color: str
Color used for the observed data points.
- zorder: int
Z-order of the observed points (drawn above most elements).
- kwargs()
Return the style as a dictionary of keyword arguments.
- Returns:
Dictionary suitable for unpacking into a Matplotlib plotting call (e.g.,
ax.errorbar(**kwargs)).- Return type:
dict
- class ampy.defaults.plotting.SpectralLegendStyle(mode='expand', loc='upper center', bbox_to_anchor=(0.09, 0.97, 0.9, 0.01), frameon=True, fancybox=False, edgecolor='black')
Bases:
objectDefault configuration for spectral plot legends.
This style is intended for figure-level legends placed above the multi-panel spectral plot.
- mode: str
If mode is set to “expand” the legend will be horizontally expanded to fill the Axes area (or bbox_to_anchor if defines the legend’s size).
- loc: str
Legend location string passed to Matplotlib.
- bbox_to_anchor: tuple[float, float, float, float]
Bounding box anchor for the legend in figure coordinates.
- frameon: bool
Whether to draw a frame around the legend.
- fancybox: bool
Whether to use a rounded legend box.
- edgecolor: str
Color of the legend frame.
- kwargs()
Return legend keyword arguments.
- Return type:
dict
- class ampy.defaults.plotting.SpectralLayout(figsize=(8.0, 10.0), height_ratios=(3.0, 1.0), sharex=True)
Bases:
objectDefault configuration for spectral subplots.
- figsize: tuple[float, float]
The (width, height) in inches.
- height_ratios: tuple[float, float]
Ratio of the subplot heights.
Whether to share the x-axis between subplots.
- kwargs()
Matplotlib wants gridspec_kw as a dict.
- Return type:
dict
- class ampy.defaults.plotting.SpectralColors(nu_a='tab:green', nu_m='tab:blue', nu_c='tab:orange')
Bases:
objectDefault configuration for the frequency curve colors.
- nu_a: str
Color of the synchrotron self-absorption curves.
- nu_m: str
Color of the synchrotron frequency curves.
- nu_c: str
Color of the cooling frequency curves.
- mapping()
- Return type:
Mapping[str,str]
- class ampy.defaults.plotting.DensityDistributionStyle(alpha=0.3, linewidth=0.5, linestyle='-', color='tab:purple')
Bases:
objectDefault styling for sampled or distribution density profiles.
This style is used when plotting an ensemble of density profiles (e.g., posterior samples or uncertainty bands).
- alpha: float
Transparency applied to individual density profile curves.
- linewidth: float
Line width of individual density profile curves.
- linestyle: str
Line style used for distribution curves.
- color: str
Color used for the density profile distribution.
- kwargs()
Return the style as Matplotlib keyword arguments.
- Returns:
Dictionary suitable for unpacking into a Matplotlib line plotting call (e.g.,
ax.plot(**kwargs)).- Return type:
dict
- class ampy.defaults.plotting.DensityBestStyle(linewidth=2.0, linestyle='-', color='tab:orange', label='Most Likely')
Bases:
objectDefault styling for the most-likely (best-fit) density profile.
This style is intended to visually distinguish the best-fit density profile from the broader distribution.
- linewidth: float
Line width of the best-fit density profile curve.
- linestyle: str
Line style used for the best-fit density profile.
- color: str
Color used for the best-fit density profile.
- label: str
Legend label for the best-fit density profile.
- kwargs()
Return the style as Matplotlib keyword arguments.
- Returns:
Dictionary suitable for unpacking into a Matplotlib line plotting call (e.g.,
ax.plot(**kwargs)).- Return type:
dict
- class ampy.defaults.plotting.SpectralPlotDefaults(observed=<factory>, legend=<factory>, layout=<factory>, colors=<factory>)
Bases:
objectDefault plotting configuration for spectral figures.
This class groups all default styling and layout options used when generating spectral plots in AMPy. Users may override any subset of these defaults by constructing a new instance.
- observed: ObservedIndexStyle
Defaults for observed spectral index markers.
- legend: SpectralLegendStyle
Defaults for the figure-level legend.
- layout: SpectralLayout
Defaults for subplot layout and sizing.
- colors: SpectralColors
Default colors for spectral break curves.
- class ampy.defaults.plotting.DensityProfileDefaults(distribution=<factory>, best=<factory>)
Bases:
objectDefault plotting configuration for density profile figures.
This class groups all default styling options used when plotting circumburst density profiles in AMPy.
- distribution: DensityDistributionStyle
Defaults for sampled or distribution density profile curves.
- best: DensityBestStyle
Defaults for the most-likely (best-fit) density profile curve.