ott.tools.plot.Plot#
- class ott.tools.plot.Plot(fig=None, ax=None, threshold=-1.0, scale=200, show_lines=True, cmap='cool', scale_alpha_by_coupling=False, alpha=0.7, title=None)[source]#
Plot an optimal transport map between two point clouds.
This object can either plot or update a plot, to create animations as a
FuncAnimation
, which can in turned be saved to disk at will. There are two design principles here:we do not rely on saving to/loading from disk to create animations
we try as much as possible to disentangle the transport problem from its visualization.
We use 2D scatter plots by default, relying on PCA visualization for d>3 data. This step requires a conversion to a numpy array, in order to compute leading singular values. This tool is therefore not designed having performance in mind.
- Parameters:
fig – Specify figure object. Created by default
ax – Specify axes objects. Created by default
threshold – value below which links in transportation matrix won’t be plotted. This value should be negative when using animations.
scale – scale used for marker plots.
show_lines – whether to show OT lines, as described in
ot.matrix
argumentcmap – color map used to plot line colors.
scale_alpha_by_coupling – use or not the coupling’s value as proxy for alpha
alpha – default alpha value for lines.
title – title of the plot.
Methods
animate
(transports[, titles, frame_rate])Make an animation from several transports.
update
(ot[, title])Update a plot with a transport instance.