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: PyQt5.QtWidgets.QMainWindow, mesmerize.plotting.widgets.base.BasePlotWidget

live_datapoint_tracer = None

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

Parameters:transmission – Input transmission
set_input(*args, **kwds)

Set the input Transmission with data to plot

Parameters:transmission – Input transmission
get_plot_opts(drop: bool = False) → dict[source]

Get the plot options

Parameters: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.UUID)[source]

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

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.
open_plot_dialog(filepath, dirpath, *args, **kwargs)

Open plot 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

Parameters:path – Path to save the file to. For easy identification use “.ptrn” extension.
save_plot_dialog(path, *args)

Plot save dialog


The input transmission

Return type:Transmission


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

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

Bases: PyQt5.QtCore.QObject


Emits the UUID of a spot when it is clicked

__init__(graphics_view: mesmerize.pyqtgraphCore.widgets.GraphicsLayoutWidget.GraphicsLayoutWidget, parent=None)[source]
Parameters:graphics_view – This plot will instantiate within this GraphicsLayoutWidget
add_data(xs: numpy.ndarray, ys: numpy.ndarray, uuid_series: pandas.core.series.Series, color: Union[str, PyQt5.QtGui.QColor, PyQt5.QtGui.QBrush, List[Union[PyQt5.QtGui.QBrush, PyQt5.QtGui.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: 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