solarwindpy.plotting.orbits.OrbitHist1D

class OrbitHist1D(orbit, x, **kwargs)[source]

Bases: OrbitPlot, Hist1D

__init__(orbit, x, **kwargs)[source]

Create a one-dimensional histogram.

Parameters:
  • x (pandas.Series) – Data from which to create bins.

  • y (pandas.Series or None, optional) – Values to aggregate in bins of x. If None, counts of x are used.

  • logx (bool, optional) – If True, compute bins in logarithmic space.

  • axnorm ({"t", "d", None}, optional) – Normalisation applied to the histogram. "t" uses total counts and "d" yields a density.

  • clip_data (bool, optional) – Remove extreme values at the 0.001 and 0.999 percentiles before binning or aggregation.

  • nbins (int or array-like, optional) – Binning strategy passed to numpy.histogram_bin_edges() or pandas.cut() depending on the input type.

  • bin_precision (int, optional) – Precision for decimal bin edges.

agg(**kwargs)[source]

Perform the aggregation along the agg axes.

If either of the count limits specified in clim are not None, apply them.

fcn allows you to specify a specific function for aggregation. Otherwise, automatically choose β€œcount” or β€œmean” based on the uniqueness of the aggregated values.

make_plot(ax=None, fcn=None, **kwargs)[source]

Make a plot 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.

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)
construct_cdf(only_plotted=True)

Convert the obsered measuremets.

Returns:

cdf – β€œx” column is the value of the measuremnt. β€œposition” column is the normalized position in the cdf. To plot the cdf:

cdf.plot(x=”x”, y=”cdf”)

Return type:

pd.DataFrame

property cut
property data
property edges
get_plotted_data_boolean_series()

Return a boolean pd.Series identifying 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.

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.

property orbit
property path

Path for saving figure.

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

d

Density normalize

t

Total normalize

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, 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