Scatter Plot


Higher level widget that is directly used by the end-user. Scatter plot with docked Control Widget, Datapoint Tracer, and Console.

class mesmerize.plotting.ScatterPlotWidget[source]

Bases: QMainWindow, BasePlotWidget


Instance of DatapointTracer

set_update_live(b: bool)[source]

Must be implemented in subclass

set_input(*args, **kwds)

Set the input Transmission with data to plot


transmission – Input transmission

get_plot_opts(drop: bool = False) dict[source]

Get the plot options


drop – no drop opts are specified for this plot

set_plot_opts(*args, **kwds)

Must be implemented in subclass


Update the plot data and draw

set_current_datapoint(identifier: UUID)[source]

Set the UUID of the current datapoint and update the Datapoint Tracer

property transmission: Transmission

The input transmission

Return type:


save_plot_dialog(path, *args)

Plot save dialog


Save the plot as a Transmission in an HDF5 file. Plot parameters are stored as a JSON string within the HDF5 file. See Transmission.to_hdf5


path – Path to save the file to. For easy identification use “.ptrn” extension.

open_plot_dialog(filepath, dirpath, *args, **kwargs)

Open plot dialog

open_plot(ptrn_path: str, proj_path: str) Optional[Tuple[str, str]]

Open a plot saved by the save_plot() method

  • ptrn_path – Path to the HDF5 Transmission file. By convention file extension is “.ptrn”

  • proj_path – Project path of the associated plot data.


Lower level widget that interfaces with pqytgraph.ScatterPlotItem and has some helper methods.

class mesmerize.plotting.variants.PgScatterPlot(graphics_view: GraphicsLayoutWidget, parent=None)[source]

Bases: QObject


Emits the UUID of a spot when it is clicked

__init__(graphics_view: GraphicsLayoutWidget, parent=None)[source]

graphics_view – This plot will instantiate within this GraphicsLayoutWidget

add_data(xs: ndarray, ys: ndarray, uuid_series: Series, color: Union[str, QColor, QBrush, List[Union[QBrush, QColor, str]]], size: int = 10, **kwargs)[source]

Add data to the plot

  • xs (np.ndarray) – array of x values, indices must correspond to the “ys” array

  • ys (np.ndarray) – array of y values, indices must correspond to the “xs” array

  • uuid_series (pd.Series) – series of UUID values. Each SpotItem on the plot is tagged with these UUIDs, therefore the indices must correspond to the “xs” and “ys” arrays.

  • color (Union[str, QtGui.QColor, QtGui.QBrush, List[Union[QtGui.QBrush, QtGui.QColor, str]]]) – Either a single color or list of colors that pqytgraph.fn.mkBrush() can accept

  • size (int) – spot size

  • kwargs – any additional kwargs that are passed to ScatterPlotItem.addPoints()

_clicked(plot, points)[source]

Called when the plot is clicked

set_legend(colors: dict, shapes: Optional[dict] = None)[source]

Set the legend.

  • colors (Dict[str, Union[QtGui.QColor, QtGui.QBrush, str]]) – dict mapping of labels onto their corresponding colors {‘label’: QtGui.QColor}

  • shapes (Dict[str, str]) – dict mapping of labels onto their corresponding shapes {‘label’: <shape as a str>}


Clear the legend


Clear the plot