solarwindpy.plotting.orbits.OrbitHist2Dο
- class OrbitHist2D(orbit, x, y, **kwargs)[source]ο
-
- agg(**kwargs)[source]ο
Wrap Hist1D and Hist2D agg so that we can aggergate orbit legs.
Legs: Inbound, Outbound, and Both.
- project_1d(axis, project_counts=False, **kwargs)[source]ο
Make a Hist1D from the data stored in this His2D.
- Parameters:
axis (str) β βxβ or βyβ, specifying the axis to project into 1D.
kwargs β Passed to Hist1D. Primarily to allow specifying bin_precision.
- Returns:
h1
- Return type:
Hist1D
- make_one_plot(kind, ax=None, fcn=None, cbar=True, limit_color_norm=False, cbar_kwargs=None, **kwargs)[source]ο
Make one of βInboundβ, βOutboundβ, or βBothβ plots on ax.
If ax is None, create a mpl.subplots axis.
**kwargs passed directly to ax.plot.
drawstyle defaults to steps-mid
fcn passed to self.agg. Only one function is allow b/c we donβt yet handle uncertainties.
- Viable kinds are:
kind
allowable inputs
Inbound
Inbound, I, i
Outbound
Outbound, O, o
Both
Both, B, b
- make_in_out_plot(fcn=None, cbar=True, limit_color_norm=False, cbar_kwargs=None, **kwargs)[source]ο
Plot βInboundβ and βOutboundβ on axes joined at perihelion.
If ax is None, create a mpl.subplots axis.
**kwargs passed directly to ax.plot.
drawstyle defaults to steps-mid
fcn passed to self.agg. Only one function is allow b/c we donβt yet handle uncertainties.
- make_in_out_both_plot(fcn=None, cbar=True, limit_color_norm=False, cbar_kwargs=None, **kwargs)[source]ο
Plot βInboundβ, βOutboundβ, and βBothβ on stacked axes.
If ax is None, create a mpl.subplots axis.
**kwargs passed directly to ax.plot.
drawstyle defaults to steps-mid
fcn passed to self.agg. Only one function is allow b/c we donβt yet handle uncertainties.
- property agg_axesο
The axis to aggregate into, e.g. the z variable in an (x, y, z) heatmap.
- property alimο
- property axnormο
Data normalization in plot.
Not mpl.colors.Normalize instance. That is passed as a kwarg to make_plot.
- calc_bins_intervals(nbins=101, precision=None)ο
Calculate histogram bins.
- nbins: int, str, array-like
If int, use np.histogram to calculate the bin edges. If str and nbins == βknuthβ, use astropy.stats.knuth_bin_width to calculate optimal bin widths. If str and nbins != βknuthβ, use np.histogram(data, bins=nbins) to calculate bins. If array-like, treat as bins.
- precision: int or None
Precision at which to store intervals. If None, default to 3.
- property categoricalsο
- property climο
- property clipο
- static clip_data(data, clip)ο
- property cutο
- property dataο
- property edgesο
- get_border()ο
Get the top and bottom edges of the plot.
- Returns:
border β Contains βtopβ and βbottomβ fields, each with a
pd.Series.- Return type:
namedtuple
- get_plotted_data_boolean_series()ο
Return a boolean
pd.Seriesidentifying each plotted measurement.The series shares the same index as the stored data. To align with a different index you may need to adjust the returned series.
- get_subset_above_threshold(threshold, fcn='count')ο
Get the subset of data above a given threshold using fcn to.
aggregate. If axnorm set, this is used.
- property groupedο
joint.groupby with appropriate axes passes.
- id_data_above_contour(level)ο
Gets data above the level.
- Parameters:
level (scalar) β The z-value above which to select data. Data is aggregated according to ax_norm.
- Returns:
above_contour β For data in a bin above level, indicates the x-pd.Interval within which the observation falls. NaN are observations that are below level. This object is purposely the same length as the data stored by Hist2D and can be used in groupby operations.
- Return type:
pd.Series
- property intervalsο
- property jointο
Combines the categorical and continuous data for Groupby.
- property labelsο
- property logο
- property loggerο
- make_cut()ο
Calculate the Categorical quantities for the aggregation axes.
- make_joint_h2_h1_plot(project_counts=True, kwargs_1d=None, fig_axes=None, **kwargs)ο
- make_plot(ax=None, cbar=True, limit_color_norm=False, cbar_kwargs=None, fcn=None, alpha_fcn=None, **kwargs)ο
Make a 2D plot on ax using ax.pcolormesh.
- Parameters:
ax (mpl.axes.Axes, None) β If None, create an Axes instance from plt.subplots.
cbar (bool) β If True, create color bar with labels.z.
limit_color_norm (bool) β If True, limit the color range to 0.001 and 0.999 percentile range of the z-value, count or otherwise.
cbar_kwargs (dict, None) β If not None, kwargs passed to self._make_cbar.
fcn (FunctionType, None) β Aggregation function. If None, automatically select in
agg().alpha_fcn (None, str) β If not None, the function used to aggregate the data for setting alpha value.
kwargs β Passed to ax.pcolormesh. If row or column normalized data, norm defaults to mpl.colors.Normalize(0, 1).
- Returns:
ax (mpl.axes.Axes) β Axes upon which plot was made.
cbar_or_mappable (colorbar.Colorbar, mpl.collections.QuadMesh) β If cbar is True, return the colorbar. Otherwise, return the Quadmesh used to create the colorbar.
- property orbitο
- property pathο
Path for saving figure.
- plot_contours(ax=None, label_levels=True, cbar=True, limit_color_norm=False, cbar_kwargs=None, fcn=None, plot_edges=False, edges_kwargs=None, clabel_kwargs=None, skip_max_clbl=True, use_contourf=False, gaussian_filter_std=0, gaussian_filter_kwargs=None, nan_aware_filter=False, **kwargs)ο
Make a contour plot on ax using ax.contour.
- Parameters:
ax (mpl.axes.Axes, None) β If None, create an Axes instance from plt.subplots.
label_levels (bool) β If True, add labels to contours with ax.clabel.
cbar (bool) β If True, create color bar with labels.z.
limit_color_norm (bool) β If True, limit the color range to 0.001 and 0.999 percentile range of the z-value, count or otherwise.
cbar_kwargs (dict, None) β If not None, kwargs passed to self._make_cbar.
fcn (FunctionType, None) β Aggregation function. If None, automatically select in
agg().plot_edges (bool) β If True, plot the smoothed, extreme edges of the 2D histogram.
edges_kwargs (None, dict) β Passed to {self.plot_edges!s}.
clabel_kwargs (None, dict) β If not None, dictionary of kwargs passed to ax.clabel.
skip_max_clbl (bool) β If True, donβt label the maximum contour. Primarily used when the maximum contour is, effectively, a point.
maximum_color β The color for the maximum of the PDF.
use_contourf (bool) β If True, use ax.contourf. Else use ax.contour.
gaussian_filter_std (int) β If > 0, apply scipy.ndimage.gaussian_filter to the z-values using the standard deviation specified by gaussian_filter_std.
gaussian_filter_kwargs (None, dict) β If not None and gaussian_filter_std > 0, passed to
scipy.ndimage.gaussian_filter()nan_aware_filter (bool) β If True and gaussian_filter_std > 0, use NaN-aware filtering via normalized convolution. Otherwise use standard scipy.ndimage.gaussian_filter.
kwargs β Passed to
ax.pcolormesh(). If row or column normalized data, norm defaults to mpl.colors.Normalize(0, 1).
- plot_edges(ax, smooth=True, sg_kwargs=None, **kwargs)ο
Overplot the edges.
- Parameters:
ax β Axis on which to plot.
smooth (bool) β If True, apply a Savitzky-Golay filter (
scipy.signal.savgol_filter()) to the y-values before plotting to smooth the curve.sg_kwargs (dict, None) β If not None, dict of kwargs passed to Savitzky-Golay filter. Also allows for setting of window_length and polyorder as kwargs. They default to 10% of the number of observations (window_length) and 3 (polyorder). Note that because window_length must be odd, if the 10% value is even, we take 1-window_length.
kwargs β Passed to ax.plot
- plot_hist_with_contours(ax=None, cbar=True, limit_color_norm=False, cbar_kwargs=None, fcn=None, levels=None, label_levels=False, use_contourf=True, contour_kwargs=None, clabel_kwargs=None, skip_max_clbl=True, gaussian_filter_std=0, gaussian_filter_kwargs=None, nan_aware_filter=False, **kwargs)ο
Make a 2D pcolormesh plot with contour overlay.
Combines make_plot (pcolormesh background) with plot_contours (contour/contourf overlay) in a single call.
- Parameters:
ax (mpl.axes.Axes, None) β If None, create an Axes instance from plt.subplots.
cbar (bool) β If True, create color bar with labels.z.
limit_color_norm (bool) β If True, limit the color range to 0.001 and 0.999 percentile range.
cbar_kwargs (dict, None) β If not None, kwargs passed to self._make_cbar.
fcn (FunctionType, None) β Aggregation function. If None, automatically select.
levels (array-like, int, None) β Contour levels. If None, automatically determined.
label_levels (bool) β If True, add labels to contours with ax.clabel.
use_contourf (bool) β If True, use filled contours. Else use line contours.
contour_kwargs (dict, None) β Additional kwargs passed to contour/contourf (e.g., linestyles, colors).
clabel_kwargs (dict, None) β Kwargs passed to ax.clabel.
skip_max_clbl (bool) β If True, donβt label the maximum contour level.
gaussian_filter_std (int) β If > 0, apply Gaussian filter to contour data.
gaussian_filter_kwargs (dict, None) β Kwargs passed to scipy.ndimage.gaussian_filter.
nan_aware_filter (bool) β If True and gaussian_filter_std > 0, use NaN-aware filtering via normalized convolution. Otherwise use standard scipy.ndimage.gaussian_filter.
kwargs β Passed to ax.pcolormesh.
- Returns:
ax (mpl.axes.Axes)
cbar_or_mappable (colorbar.Colorbar or QuadMesh)
qset (QuadContourSet) β The contour set from the overlay.
lbls (list or None) β Contour labels if label_levels is True.
- set_alim(lower=None, upper=None)ο
Set the minimum (lower) and maximum (upper) allowed value when.
aggregating. This is different from clim because it uses the agg_fcn. So behavior will change based on axnorm, etc.
- set_axnorm(new)ο
The method by which the gridded data is normalized.
key
description
c
Column normalize
d
Density normalize
r
Row normalize
t
Total normalize
cd
PDFs in each column
rd
PDFs in each row
- set_clim(lower=None, upper=None)ο
Set the minimum (lower) and maximum (upper) allowed number of.
counts per bin to return after calling
agg().
- set_data(x, y, z, clip)ο
- 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_orbit(new)ο
IntervalIndex corresponding to the times we want to subset the orbit.
- set_path(*args, orbit=None, **kwargs)ο
Set path information, accounting for orbit info.
- take_data_in_yrange_across_x(ranges_by_x, get_x_bounds, get_y_bounds)ο
Take data within y-ranges across x-values.
- Parameters:
ranges_by_x (iterable) β An iterable with keys used to get the left and right bounds for the data and values used to get the top and bottom bounds for the data.
get_x_bounds (function) β First argument is one key of ranges_by_x and returns left, right. Second argument is a kwarg (expected_logx) boolean to transform the returned values according to whether or not the keys are \(log(x)\) or \(x\) in a manner that matches data stored in Hist2D.
get_y_bounds (functions) β Takes on value of ranges_by_x and returns top, bottom. Second argument Second argument is a kwarg (expected_logx) boolean to transform the returned values according to whether or not the keys are \(log(y)\) or \(y\) in a manner that matches data stored in Hist2D.
- Returns:
taken β Array of indices for selecting data in interval.
- Return type:
np.ndarray 1D