Set of widgets to associate with a :class:’PlotWidget’.
Bases: PyQt4.QtGui.QWidget
QWidget displaying coords converted from data coords of the mouse.
Provide this widget with a list of couple:
To run the following sample code, a QApplication must be initialized. First, create a PlotWindow and add a QToolBar where to place the PositionInfo widget.
>>> from silx.gui.plot import PlotWindow
>>> from silx.gui import qt
>>> plot = PlotWindow() # Create a PlotWindow to add the widget to
>>> toolBar = qt.QToolBar() # Create a toolbar to place the widget in
>>> plot.addToolBar(qt.Qt.BottomToolBarArea, toolBar) # Add it to plot
Then, create the PositionInfo widget and add it to the toolbar. The PositionInfo widget is created with a list of converters, here to display polar coordinates of the mouse position.
>>> import numpy
>>> from silx.gui.plot.PlotTools import PositionInfo
>>> position = PositionInfo(plot=plot, converters=[
... ('Radius', lambda x, y: numpy.sqrt(x*x + y*y)),
... ('Angle', lambda x, y: numpy.degrees(numpy.arctan2(y, x)))])
>>> toolBar.addWidget(position) # Add the widget to the toolbar
<...>
>>> plot.show() # To display the PlotWindow with the position widget
Parameters: |
|
---|
Toggle snapping use position to active curve.
The PlotWindow this widget is attached to.
Bases: PyQt4.QtGui.QToolBar
QToolBar displaying and controlling the limits of a PlotWidget.
To run the following sample code, a QApplication must be initialized. First, create a PlotWindow:
>>> from silx.gui.plot import PlotWindow
>>> plot = PlotWindow() # Create a PlotWindow to add the toolbar to
Then, create the LimitsToolBar and add it to the PlotWindow.
>>> from silx.gui import qt
>>> from silx.gui.plot.PlotTools import LimitsToolBar
>>> toolbar = LimitsToolBar(plot=plot) # Create the toolbar
>>> plot.addToolBar(qt.Qt.BottomToolBarArea, toolbar) # Add it to the plot
>>> plot.show() # To display the PlotWindow with the limits toolbar
Parameters: |
|
---|
Module containing several widgets associated to a colormap.
Colorbar widget displaying a colormap
It uses a description of colormap as dict compatible with Plot.
To run the following sample code, a QApplication must be initialized.
>>> from silx.gui.plot import Plot2D
>>> from silx.gui.plot.ColorBar import ColorBarWidget
>>> plot = Plot2D() # Create a plot widget
>>> plot.show()
>>> colorbar = ColorBarWidget(plot=plot, legend='Colormap') # Associate the colorbar with it
>>> colorbar.show()
Initializer parameters:
Parameters: |
|
---|
Associate a plot to the ColorBar
Parameters: | plot – the plot to associate with the colorbar. If None will remove any connection with a previous plot. |
---|
Return the colormap displayed in the colorbar as a dict.
It returns None if no colormap is set. See silx.gui.plot.Plot documentation for the description of the colormap dict description.
Set the colormap to be displayed.
Parameters: | colormap (dict) – The colormap to apply on the ColorBarWidget |
---|
Set the legend displayed along the colorbar
Parameters: | legend (str) – The label |
---|