PlotWindow
: Plot widget with toolbar¶
A PlotWidget
with additional toolbars.
The PlotWindow
is a subclass of PlotWidget
.
PlotWindow
class¶
- class PlotWindow(parent=None, backend=None, resetzoom=True, autoScale=True, logScale=True, grid=True, curveStyle=True, colormap=True, aspectRatio=True, yInverted=True, copy=True, save=True, print_=True, control=False, position=False, roi=True, mask=True, fit=False)[source]¶
Bases:
silx.gui.plot.PlotWidget.PlotWidget
Qt Widget providing a 1D/2D plot area and additional tools.
This widgets inherits from
PlotWidget
and provides its plot API.Initialiser parameters:
- Parameters
parent – The parent of this widget or None.
backend (str or
BackendBase.BackendBase
) – The backend to use for the plot (default: matplotlib). SeePlotWidget
for the list of supported backend.resetzoom (bool) – Toggle visibility of reset zoom action.
autoScale (bool) – Toggle visibility of axes autoscale actions.
logScale (bool) – Toggle visibility of axes log scale actions.
grid (bool) – Toggle visibility of grid mode action.
curveStyle (bool) – Toggle visibility of curve style action.
colormap (bool) – Toggle visibility of colormap action.
aspectRatio (bool) – Toggle visibility of aspect ratio button.
yInverted (bool) – Toggle visibility of Y axis direction button.
copy (bool) – Toggle visibility of copy action.
save (bool) – Toggle visibility of save action.
print (bool) – Toggle visibility of print action.
control (bool) – True to display an Options button with a sub-menu to show legends, toggle crosshair and pan with arrows. (Default: False)
position – True to display widget with (x, y) mouse position (Default: False). It also supports a list of (name, funct(x, y)->value) to customize the displayed values. See
PositionInfo
.roi (bool) – Toggle visibilty of ROI action.
mask (bool) – Toggle visibilty of mask action.
fit (bool) – Toggle visibilty of fit action.
- setBackend(backend)[source]¶
Set the backend to use for rendering.
Supported backends:
‘matplotlib’ and ‘mpl’: Matplotlib with Qt.
‘opengl’ and ‘gl’: OpenGL backend (requires PyOpenGL and OpenGL >= 2.1)
‘none’: No backend, to run headless for testing purpose.
- Parameters
backend (Union[str,BackendBase,List[Union[str,BackendBase]]]) – The backend to use, in: ‘matplotlib’ (default), ‘mpl’, ‘opengl’, ‘gl’, ‘none’, a
BackendBase.BackendBase
class. If multiple backends are provided, the first available one is used.- Raises
ValueError – Unsupported backend descriptor
RuntimeError – Error while loading a backend
- setBackgroundColor(color)[source]¶
Set the background color of this widget.
- Parameters
color (Union[List[int],List[float],QColor]) – The new RGB(A) color.
- setDataBackgroundColor(color)[source]¶
Set the background color of the plot area.
Set to None or an invalid QColor to use the background color.
- Parameters
color (Union[List[int],List[float],QColor,None]) – The new RGB(A) color.
- setForegroundColor(color)[source]¶
Set the foreground color of this widget.
- Parameters
color (Union[List[int],List[float],QColor]) – The new RGB(A) color.
- getInteractiveModeToolBar()[source]¶
Returns QToolBar controlling interactive mode.
- Return type
QToolBar
- getOutputToolBar()[source]¶
Returns QToolBar containing save, copy and print actions
- Return type
QToolBar
- getPositionInfoWidget()[source]¶
Returns the widget displaying current cursor position information
- Return type
- getSelectionMask()[source]¶
Return the current mask handled by
maskToolsDockWidget
.- Returns
The array of the mask with dimension of the ‘active’ image. If there is no active image, an empty array is returned.
- Return type
2D numpy.ndarray of uint8
- setSelectionMask(mask)[source]¶
Set the mask handled by
maskToolsDockWidget
.If the provided mask has not the same dimension as the ‘active’ image, it will by cropped or padded.
- Parameters
mask (numpy.ndarray of uint8 of dimension 2, C-contiguous. Array of other types are converted.) – The array to use for the mask.
- Returns
True if success, False if failed
Return a QMenu from the QAction of the PlotWindow.
- Parameters
title (str) – The title of the QMenu
parent – See
QMenu
- addTabbedDockWidget(dock_widget)[source]¶
Add a dock widget as a new tab if there are already dock widgets in the plot. When the first tab is added, the area is chosen depending on the plot geometry: if the window is much wider than it is high, the right dock area is used, else the bottom dock area is used.
- Parameters
dock_widget – Instance of
QDockWidget
to be added.
- removeDockWidget(dockwidget)[source]¶
Removes the dockwidget from the main window layout and hides it.
Note that the dockwidget is not deleted.
- Parameters
dockwidget (QDockWidget) –
- getCurvesRoiWidget()[source]¶
Return the
CurvesROIWidget
.silx.gui.plot.CurvesROIWidget.CurvesROIWidget
offers a getter and a setter for the ROI data:CurvesROIWidget.getRois()
CurvesROIWidget.setRois()
- getConsoleAction()[source]¶
QAction handling the IPython console activation.
By default, it is connected to a method that initializes the console widget the first time the user clicks the “Console” menu button. The following clicks, after initialization is done, will toggle the visibility of the console widget.
- Return type
QAction
- getColormapAction()[source]¶
Action open a colormap dialog to change active image and default colormap.
- Return type
- getKeepDataAspectRatioAction()[source]¶
Action associated to keepDataAspectRatioButton. Use this to change the visibility of keepDataAspectRatioButton in the toolbar (See
QToolBar.addWidget()
documentation).- Return type
- getYAxisInvertedAction()[source]¶
Action associated to yAxisInvertedButton. Use this to change the visibility yAxisInvertedButton in the toolbar. (See
QToolBar.addWidget()
documentation).- Return type
- getIntensityHistogramAction()[source]¶
Action toggling the histogram intensity Plot widget
- Return type
Plot1D
: Plot curves¶
- class Plot1D(parent=None, backend=None)[source]¶
Bases:
silx.gui.plot.PlotWindow.PlotWindow
PlotWindow with tools specific for curves.
This widgets provides the plot API of
PlotWidget
.- Parameters
parent – The parent of this widget
backend (str or
BackendBase.BackendBase
) – The backend to use for the plot (default: matplotlib). SeePlotWidget
for the list of supported backend.
Plot2D
: Plot images¶
- class Plot2D(parent=None, backend=None)[source]¶
Bases:
silx.gui.plot.PlotWindow.PlotWindow
PlotWindow with a toolbar specific for images.
This widgets provides the plot API of :~:.PlotWidget.
- Parameters
parent – The parent of this widget
backend (str or
BackendBase.BackendBase
) – The backend to use for the plot (default: matplotlib). SeePlotWidget
for the list of supported backend.