5. OutlierRejection#
- class OutlierRejection(ax: Axes, data: ndarray, plot_type: str = 'scatter', bins: int = 20, marker: str = '.', label: str = '')#
Bases:
object
WORK IN PROGRESS
Handles the selection and removal of the outliers points from the plots.
Allows the users to select a set of points using the lasso selector and remove them.
Attributes
Axes object of the plot.
Canvas attribute of the plot.
Data array for scatter or histogram.
Label for the plot.
Lasso object to handle the mouse events.
Marker of the plot.
List to save the indices of the outlier points
Scatter plot object.
Methods
apply_lasso
(ax, data, plot_type, label[, ...])Applies the lasso selector to a single plot and returns the removed indices.
onselect
(coords)Handles selection of histogram bins or scatter points for removal using lasso.
set_outliers
(json_file_path)Updates the outlier flag in a JSON file for specified indices.
Updates scatter plot by removing selected points.
- static apply_lasso(ax: Axes, data: array, plot_type: str, label: str, marker: str = 'o', bins: int = 20)#
Applies the lasso selector to a single plot and returns the removed indices.
- Parameters:
ax (Axes) – Matplotlib Axes object.
data (np.array) – Data array for scatter or histogram.
plot_type (str) – Type of plot (“scatter” or “histogram”).
label (str) – Label for the dataset.
marker (str, optional) – Marker style for scatter plots (ignored for histograms).
bins (int, optional) – Number of bins for histogram (ignored for scatter plots).
- onselect(coords: list)#
Handles selection of histogram bins or scatter points for removal using lasso.
- set_outliers(json_file_path)#
Updates the outlier flag in a JSON file for specified indices.
- update_plot()#
Updates scatter plot by removing selected points.
- property ax#
Axes object of the plot. :base: OutlierRejection :type: matplotlib.axes.Axes
- property canvas#
Canvas attribute of the plot.
- Base:
OutlierRejection
- Type:
- property data#
Data array for scatter or histogram.
- Base:
OutlierRejection
- Base:
numpy.ndarray
- property lasso#
Lasso object to handle the mouse events.
- Base:
OutlierRejection
- Type:
- property removed_indices#
List to save the indices of the outlier points
- property scatter#
Scatter plot object.
- Base:
OutlierRejection
- Type: