Scatter Plot

ScatterPlotWidget

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

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

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_plot()[source]

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

property transmission

The input transmission

Return type

Transmission

save_plot_dialog(path, *args)

Plot save dialog

save_plot(path)

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.

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

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

  • proj_path – Project path of the associated plot data.

Variant

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

signal_spot_clicked

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

Parameters
  • 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.

Parameters
  • 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_legend()[source]

Clear the legend

clear()[source]

Clear the plot