deepof.visuals.plot_embeddings

deepof.visuals.plot_embeddings(coordinates: deepof_coordinates, embeddings: deepof_table_dict | None = None, soft_counts: deepof_table_dict | None = None, breaks: deepof_table_dict | None = None, supervised_annotations: deepof_table_dict | None = None, min_confidence: float = 0.0, bin_size: int | None = None, bin_index: int = 0, precomputed_bins: ndarray | None = None, normative_model: str | None = None, add_stats: str = 'Mann-Whitney', verbose: bool = False, exp_condition: str | None = None, aggregate_experiments: str = False, samples: int = 500, show_aggregated_density: bool = True, colour_by: str = 'cluster', show_break_size_as_radius: bool = False, ax: Any | None = None, save: bool = False)

Return a scatter plot of the passed projection. Allows for temporal and quality filtering, animal aggregation, and changepoint detection size visualization.

Parameters:
  • coordinates (coordinates) – deepOF project where the data is stored.

  • embeddings (table_dict) – table dict with neural embeddings per animal experiment across time.

  • soft_counts (table_dict) – table dict with soft cluster assignments per animal experiment across time.

  • breaks (table_dict) – table dict with changepoint detection breaks per experiment.

  • supervised_annotations (table_dict) – table dict with supervised annotations per experiment.

  • exp_condition (str) – Name of the experimental condition to use when plotting. If None (default) the first one available is used.

  • normative_model (str) – Name of the cohort to use as controls. If provided, fits a Gaussian density to the control global animal embeddings, and reports the difference in likelihood across all instances of the provided experimental condition. Statistical parameters can be controlled via **kwargs (see full documentation for details).

  • add_stats (str) – test to use. Mann-Whitney (non-parametric) by default. See statsannotations documentation for details.

  • verbose (bool) – if True, prints test results and p-value cutoffs. False by default.

  • min_confidence (float) – minimum confidence in cluster assignments used for quality control filtering.

  • bin_size (int) – bin size for time filtering.

  • bin_index (int) – index of the bin of size bin_size to select along the time dimension.

  • precomputed_bins (np.ndarray) – precomputed time bins. If provided, bin_size and bin_index are ignored.

  • aggregate_experiments (str) – Whether to aggregate embeddings by experiment (by time on cluster, mean, or median) or not (default).

  • samples (int) – Number of samples to take from the time embeddings. None leads to plotting all time-points, which may hurt performance.

  • show_aggregated_density (bool) – if True, a density plot is added to the aggregated embeddings.

  • colour_by (str) – hue by which to colour the embeddings. Can be one of ‘cluster’ (default), ‘exp_condition’, or ‘exp_id’.

  • show_break_size_as_radius (bool) – Only usable when embeddings come from a model using changepoint detection. If True, the size of each chunk is depicted as the radius of each dot.

  • ax (plt.AxesSubplot) – axes where to plot the current figure. If not provided, new figure will be created.

  • save (bool) – Saves a time-stamped vectorized version of the figure if True.