visualization

Some convenient visalisation routines.

pydiffmap.visualization.data_plot(dmap_instance, n_evec=1, dim=2, scatter_kwargs=None, show=True)[source]

Creates diffusion map embedding scatterplot. By default, the first two diffusion coordinates are plotted against each other. This only plots against the first two or three (as controlled by ‘dim’ parameter) dimensions of the data, however: effectively this assumes the data is two resp. three dimensional.

Parameters:
  • dmap_instance (DiffusionMap Instance) – An instance of the DiffusionMap class.
  • n_evec (int, optional) – The eigenfunction that should be used to color the plot.
  • dim (int, optional, 2 or 3.) – Optional argument that controls if a two- or three dimensional plot is produced.
  • scatter_kwargs (dict, optional) – Optional arguments to be passed to the scatter plot, e.g. point color, point size, colormap, etc.
  • show (boolean, optional) – If true, calls plt.show()
Returns:

fig (pyplot figure object) – Figure object where everything is plotted on.

pydiffmap.visualization.embedding_plot(dmap_instance, dim=2, scatter_kwargs=None, show=True)[source]

Creates diffusion map embedding scatterplot. By default, the first two diffusion coordinates are plotted against each other.

Parameters:
  • dmap_instance (DiffusionMap Instance) – An instance of the DiffusionMap class.
  • dim (int, optional, 2 or 3.) – Optional argument that controls if a two- or three dimensional plot is produced.
  • scatter_kwargs (dict, optional) – Optional arguments to be passed to the scatter plot, e.g. point color, point size, colormap, etc.
  • show (boolean, optional) – If true, calls plt.show()
Returns:

fig (pyplot figure object) – Figure object where everything is plotted on.

Examples

# Plots the top two diffusion coords, colored by the first coord. >>> scatter_kwargs = {‘s’: 2, ‘c’: mydmap.dmap[:,0], ‘cmap’: ‘viridis’} >>> embedding_plot(mydmap, scatter_kwargs)