shnitsel.vis.datasheet.figures.hist¶
Functions¶
|
Function to calculate the upper cutoff-threshold of data such that |
|
Helper function to truncate the data array on the upper end by a threshold |
|
Function to create a pair of axes on top of and beside the axes passed as an argument to plot additional |
|
Function to add a set of marginal axes with create_marginals() for the axes at key label in axs |
Module Contents¶
- calc_truncation_maximum(data, rel_cutoff=0.01, bins=1000)¶
Function to calculate the upper cutoff-threshold of data such that the frequency in the last bin is at least rel_cutoff times the maximum frequency.
Helps to limit outliers.
- Parameters:
data – The data that should be histogrammed and filtered.
rel_cutoff (float, optional) – Factor relative to the frequency maximum that should be used for determining the cutoff. Defaults to 0.01.
bins (int, optional) – How many bins should be used for getting the correct threshold location. Defaults to 1000.
- Returns:
Upper cutoff position to stay above the rel_cutoff relative threshold.
- Return type:
- truncate_from_above(data, rel_cutoff=0.01, bins=1000)¶
Helper function to truncate the data array on the upper end by a threshold such that the histogram frequency stays above rel_cutoff*max(frequency) and is below this relative cutoff above the cutoff.
- Parameters:
data (numpy.typing.NDArray) – The data that should be histogrammed and filtered.
rel_cutoff (float, optional) – Factor relative to the frequency maximum that should be used for determining the cutoff. Defaults to 0.01.
bins (int, optional) – How many bins should be used for getting the correct threshold location. Defaults to 1000.
- Returns:
The filtered data array
- Return type:
npt.NDArray
- create_marginals(ax)¶
Function to create a pair of axes on top of and beside the axes passed as an argument to plot additional data into.
Generally used for plotting dimension-specific histograms next to xy-plots.
- Parameters:
ax (Axes) – Axes to create marginal plots inside of
- Returns:
Resulting pair of outset axes.
- Return type:
tuple[Axes, Axes]
- create_marginals_dict(axs, label)¶
Function to add a set of marginal axes with create_marginals() for the axes at key label in axs and add the marginal axes back into the dict with appended x and y suffixes.