solarwindpy.plotting.spiral.SpiralPlot2D

class SpiralPlot2D(x, y, z=None, logx=False, logy=False, initial_bins=5, clip_data=False)[source]

Bases: PlotWithZdata, CbarMaker

2D spiral plotting with adaptive mesh refinement.

Examples

splot = SpiralPlot2D(…) splot.initialize_mesh()

__init__(x, y, z=None, logx=False, logy=False, initial_bins=5, clip_data=False)[source]
property clim
property initial_bins
property grouped
property mesh
agg(fcn=None)[source]

Aggregate the z-values into their bins.

build_grouped()[source]
calc_initial_bins(nbins)[source]
initialize_mesh(**kwargs)[source]
set_clim(lower=None, upper=None)[source]

Set the min (lower) and max (upper) counts per bin.

This limit is applied after the groupby.agg() is run.

set_data(x, y, z, clip)[source]
make_plot(ax=None, cbar=True, limit_color_norm=False, cbar_kwargs=None, fcn=None, alpha_fcn=None, **kwargs)[source]
plot_contours(ax=None, method='rbf', rbf_neighbors=50, rbf_smoothing=1.0, rbf_kernel='thin_plate_spline', grid_resolution=100, gaussian_filter_std=1.5, interpolation='cubic', nan_aware_filter=True, label_levels=True, cbar=True, cbar_kwargs=None, fcn=None, clabel_kwargs=None, skip_max_clbl=True, use_contourf=False, **kwargs)[source]

Make a contour plot from adaptive mesh data with optional smoothing.

Supports three interpolation methods for generating contours from the irregular adaptive mesh:

  • "rbf": Sparse RBF interpolation (default, fastest with built-in smoothing)

  • "grid": Grid interpolation + Gaussian smoothing (matches Hist2D API)

  • "tricontour": Direct triangulated contours (no smoothing, for debugging)

Parameters:
  • ax (mpl.axes.Axes, None) – If None, create an Axes instance from plt.subplots.

  • method ({"rbf", "grid", "tricontour"}) – Interpolation method. Default is "rbf" (fastest with smoothing).

  • Parameters (Common)

  • ---------------------

  • rbf_neighbors (int) – Number of nearest neighbors for sparse RBF. Higher = smoother but slower. Default is 50.

  • rbf_smoothing (float) – RBF smoothing parameter. Higher values produce smoother surfaces. Default is 1.0.

  • rbf_kernel (str) – RBF kernel type. Options: “thin_plate_spline”, “cubic”, “quintic”, “multiquadric”, “inverse_multiquadric”, “gaussian”.

  • Parameters

  • ----------------------

  • grid_resolution (int) – Number of grid points along each axis. Default is 100.

  • gaussian_filter_std (float) – Standard deviation for Gaussian smoothing. Default is 1.5. Set to 0 to disable smoothing.

  • interpolation ({"linear", "cubic", "nearest"}) – Interpolation method for griddata. Default is “cubic”.

  • nan_aware_filter (bool) – If True, use NaN-aware Gaussian filtering. Default is True.

  • Parameters

  • -----------------

  • label_levels (bool) – If True, add labels to contours with ax.clabel. Default is True.

  • cbar (bool) – If True, create a colorbar. Default is True.

  • cbar_kwargs (dict, None) – Keyword arguments passed to self._make_cbar.

  • fcn (callable, None) – Aggregation function. If None, automatically select in agg().

  • clabel_kwargs (dict, None) – Keyword arguments passed to ax.clabel.

  • skip_max_clbl (bool) – If True, don’t label the maximum contour level. Default is True.

  • use_contourf (bool) – If True, use filled contours. Default is False.

  • **kwargs – Additional arguments passed to the contour function. Common options: levels, cmap, norm, linestyles.

Returns:

  • ax (mpl.axes.Axes) – The axes containing the plot.

  • lbls (list or None) – Contour labels if label_levels=True, else None.

  • cbar_or_mappable (Colorbar or QuadContourSet) – The colorbar if cbar=True, else the contour set.

  • qset (QuadContourSet) – The contour set object.

Examples

>>> # Default: sparse RBF (fastest)
>>> ax, lbls, cbar, qset = splot.plot_contours()
>>> # Grid interpolation with Gaussian smoothing
>>> ax, lbls, cbar, qset = splot.plot_contours(
...     method='grid',
...     grid_resolution=100,
...     gaussian_filter_std=2.0
... )
>>> # Debug: see raw triangulation
>>> ax, lbls, cbar, qset = splot.plot_contours(method='tricontour')
property clip
property data
property labels
property log
property logger
property path

Path for saving figure.

set_labels(**kwargs)

Set or update x, y, or z labels. Any label not specified in kwargs.

is propagated from self.labels.<x, y, or z>.

set_log(x=None, y=None)
set_path(new, add_scale=True)

Build the plot save path.

Parameters:
  • new (str or Path) – If str and == “auto”, then build path from self.labels. Otherwise, assume parameter specifies the desired path and use Path(new).

  • add_scale (bool) – If True, add information about the axis scales to the end of the path.