elisa.plot.util#
Helper functions for plotting.
- get_color_gradient(color: str, n: int, factor_min: float = 0.9, factor_max: float = 1.5) list[str][source]#
Create a sequence of color gradient.
- get_contour_colors(color: str, n: int, factor_min: float = 0.9, factor_max: float = 1.5, factor_f: float = 0.72) tuple[source]#
Create two sets of colors for contour and contourf plots.
- gaussian_kernel_smooth(x: ndarray, y: ndarray, sigma: int | float, x_eval: ndarray | None = None, null_thresh: float = 0.683) ndarray[source]#
Apply Gaussian kernel regression to data and then interpolate it.
Note
The regression here is also known as Nadaraya-Watson kernel regression [1]. This helper function is adapted from [2].
- Parameters:
- x, y
ndarray Arrays of x- and y-coordinates of data. Must be 1d and have the same length.
- sigma
float Standard deviation of the Gaussian to apply to each data point. Larger values yield a smoother curve.
- x_eval
ndarray, optional Array of x-coordinates at which to evaluate the smoothed result. The default is x.
- null_thresh
float For evaluation points far from data points, the estimate will be based on very little data. If the total weight is below this threshold, return np.nan at this location. Zero means always return an estimate. The default of 0.6 corresponds to approximately one sigma away from the nearest datapoint.
- x, y
- Returns:
- smoothed
ndarray Smoothed data at x_eval.
- smoothed
References