PlotToolButtons: QToolButtons for plot widgets

This module provides a set of QToolButton to use with PlotWidget.

The following QToolButton are available:

class PlotToolButton(parent=None, plot=None)[source]

A QToolButton connected to a PlotWidget.

plot()[source]

Returns the plot connected to the widget.

setPlot(plot)[source]

Set the plot connected to the widget

Parameters:

plotPlotWidget instance on which to operate.

class AspectToolButton(parent=None, plot=None)[source]

Tool button to switch keep aspect ratio of a plot

STATE = None

Lazy loaded states used to feed AspectToolButton

keepDataAspectRatio()[source]

Configure the plot to keep the aspect ratio

dontKeepDataAspectRatio()[source]

Configure the plot to not keep the aspect ratio

class YAxisOriginToolButton(parent=None, plot=None)[source]

Tool button to switch the Y axis orientation of a plot.

STATE = None

Lazy loaded states used to feed YAxisOriginToolButton

setYAxisUpward()[source]

Configure the plot to use y-axis upward

setYAxisDownward()[source]

Configure the plot to use y-axis downward

class ProfileOptionToolButton(parent=None, plot=None)[source]

Button to define option on the profile

setMethod(method)[source]

Set the method to use.

Parameters:

method (str) – Either ‘sum’ or ‘mean’

getMethod()[source]

Returns the current method in use (See setMethod()).

Return type:

str

class ProfileToolButton(parent=None, plot=None)[source]

Button used in Profile3DToolbar to switch between 2D profile and 1D profile.

STATE = None

Lazy loaded states used to feed ProfileToolButton

setDimension(dimension)[source]

Set the selected dimension

getDimension()[source]

Get the selected dimension.

Return type:

int (1 or 2)

class SymbolToolButton(parent=None, plot=None)[source]

A tool button with a drop-down menu to control symbol size and marker.

Parameters:
  • parent – See QWidget

  • plot – The ~silx.gui.plot.PlotWidget to control

class ScatterVisualizationToolButton(parent=None, plot=None)[source]

QToolButton to select the visualization mode of scatter plot

Parameters:
  • parent – See QWidget

  • plot – The ~silx.gui.plot.PlotWidget to control

class RulerToolButton(parent=None, plot=None, color: str = 'yellow')[source]

Button to active measurement between two point of the plot

An instance of RulerToolButton can be added to a plot toolbar like: .. code-block:: python

plot = Plot2D()

rulerButton = RulerToolButton(parent=plot, plot=plot) plot.toolBar().addWidget(rulerButton)

class RulerROI(parent=None)[source]
registerFormatFunction(fct)[source]

fct is expected to be a function taking (startPoint, endPoint) as parameter

setEndPoints(startPoint, endPoint)[source]

Set this line location using the ending points

Parameters:
  • startPoint (numpy.ndarray) – Staring bounding point of the line

  • endPoint (numpy.ndarray) – Ending bounding point of the line

setPlot(plot)[source]

Set the plot connected to the widget

Parameters:

plotPlotWidget instance on which to operate.

buildDistanceText(startPoint, endPoint)[source]

define the text to be displayed by the ruler. It can be redefine to modify precision or handle other parameters (handling pixel size to display metric distance, display distance on each distance - for non-square pixels…)