PlotActions: Actions for PlotWidget

The PlotAction is a base class used to define plot actions.

Plot actions serve to add menu items or toolbar items that are associated with a method that can interact with the associated PlotWidget.

For an introduction to creating custom plot actions, see Adding custom plot actions.

PlotActions API

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

The following QAction are available:

class silx.gui.plot.PlotActions.PlotAction(plot, icon, text, tooltip=None, triggered=None, checkable=False, parent=None)[source]

Base class for QAction that operates on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate.
  • icon – QIcon or str name of icon to use
  • text (str) – The name of this action to be used for menu label
  • tooltip (str) – The text of the tooltip
  • triggered – The callback to connect to the action’s triggered signal or None for no callback.
  • checkable (bool) – True for checkable action, False otherwise (default)
  • parent – See QAction.
plot[source]

The PlotWidget this action group is controlling.

class silx.gui.plot.PlotActions.ResetZoomAction(plot, parent=None)[source]

QAction controlling reset zoom on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.ZoomInAction(plot, parent=None)[source]

QAction performing a zoom-in on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.ZoomOutAction(plot, parent=None)[source]

QAction performing a zoom-out on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.XAxisAutoScaleAction(plot, parent=None)[source]

QAction controlling X axis autoscale on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.YAxisAutoScaleAction(plot, parent=None)[source]

QAction controlling Y axis autoscale on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.XAxisLogarithmicAction(plot, parent=None)[source]

QAction controlling X axis log scale on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.YAxisLogarithmicAction(plot, parent=None)[source]

QAction controlling Y axis log scale on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.GridAction(plot, gridMode='both', parent=None)[source]

QAction controlling grid mode on a PlotWidget.

Parameters:
class silx.gui.plot.PlotActions.CurveStyleAction(plot, parent=None)[source]

QAction controlling curve style on a PlotWidget.

It changes the default line and markers style which updates all curves on the plot.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.ColormapAction(plot, parent=None)[source]

QAction opening a ColormapDialog to update the colormap.

Both the active image colormap and the default colormap are updated.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.KeepAspectRatioAction(plot, parent=None)[source]

QAction controlling aspect ratio on a PlotWidget. :param plot: PlotWidget instance on which to operate :param parent: See QAction

class silx.gui.plot.PlotActions.YAxisInvertedAction(plot, parent=None)[source]

QAction controlling Y orientation on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.SaveAction(plot, parent=None)[source]

QAction for saving Plot content.

It opens a Save as... dialog.

Parameters:
  • plotPlotWidget instance on which to operate.
  • parent – See QAction.
class silx.gui.plot.PlotActions.PrintAction(plot, parent=None)[source]

QAction for printing the plot.

It opens a Print dialog.

Current implementation print a bitmap of the plot area and not vector graphics, so printing quality is not great.

Parameters:
  • plotPlotWidget instance on which to operate.
  • parent – See QAction.
printer[source]

The QPrinter instance used by the actions.

This is shared accross all instances of PrintAct

printPlotAsWidget()[source]

Open the print dialog and print the plot.

Use QWidget.render() to print the plot

Returns:True if successful
printPlot()[source]

Open the print dialog and print the plot.

Use Plot.saveGraph() to print the plot.

Returns:True if successful
class silx.gui.plot.PlotActions.CopyAction(plot, parent=None)[source]

QAction to copy PlotWidget content to clipboard.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
copyPlot()[source]

Copy plot content to the clipboard as a bitmap.

class silx.gui.plot.PlotActions.CrosshairAction(plot, color='black', linewidth=1, linestyle='-', parent=None)[source]

QAction toggling crosshair cursor on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • color (str) – Color to use to draw the crosshair
  • linewidth (int) – Width of the crosshair cursor
  • linestyle (str) – Style of line. See Plot.setGraphCursor()
  • parent – See QAction
color = None

Color used to draw the crosshair (str).

linewidth = None

Width of the crosshair cursor (int).

linestyle = None

Style of line of the cursor (str).

class silx.gui.plot.PlotActions.PanWithArrowKeysAction(plot, parent=None)[source]

QAction toggling pan with arrow keys on a PlotWidget.

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.FitAction(plot, parent=None)[source]

QAction to open a FitWidget and set its data to the active curve if any, or to the first curve..

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
class silx.gui.plot.PlotActions.PixelIntensitiesHistoAction(plot, parent=None)[source]

QAction to plot the pixels intensities diagram

Parameters:
  • plotPlotWidget instance on which to operate
  • parent – See QAction
computeIntensityDistribution()[source]

Get the active image and compute the image intensity distribution

eventFilter(qobject, event)[source]

Observe when the close event is emitted then simply uncheck the action button

Parameters:
  • qobject – the object observe
  • event – the event received by qobject
getHistogramPlotWidget()[source]

Return the PlotWidget showing the histogram of the pixel intensities

getHistogram()[source]

Return the histogram displayed in the HistogramPlotWiget

Table Of Contents

Previous topic

Plot: Full plot API

Next topic

PlotTools: Tool widgets for PlotWidget

This Page