summaryrefslogtreecommitdiff
path: root/doc/source/modules/gui/plot/plotwidget.rst
blob: df576fc1c4e4f79db791673b2b41b4fe74cf651f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
.. currentmodule:: silx.gui.plot

:mod:`PlotWidget`: Base class for plotting widgets
==================================================

.. module:: silx.gui.plot.PlotWidget

.. currentmodule:: silx.gui.plot.PlotWidget

The :class:`PlotWidget` is a Qt widget providing the plot API initially
provided in `PyMca <http://pymca.sourceforge.net/>`_.
It is the basis of other plot widget, thus all plot widgets share the same API.

For an introduction and examples of the plot API, see :doc:`getting_started`.

Plot API
--------

.. currentmodule:: silx.gui.plot.Plot

This is a choosen subset of the complete plot API, the full API is
documented in :class:`silx.gui.plot.Plot`.

.. currentmodule:: silx.gui.plot.PlotWidget

.. autoclass:: PlotWidget
   :show-inheritance:

Plot data
.........

Those methods allow to add and update plotted data:

.. automethod:: PlotWidget.addCurve
.. automethod:: PlotWidget.addImage
.. automethod:: PlotWidget.addScatter
.. automethod:: PlotWidget.addHistogram

Plot markers
............

It is also possible to add point or line markers to the plot:

.. automethod:: PlotWidget.addMarker
.. automethod:: PlotWidget.addXMarker
.. automethod:: PlotWidget.addYMarker

Remove data from the plot
.........................

.. automethod:: PlotWidget.clear
.. automethod:: PlotWidget.remove

Title and labels
................

Those methods handle the text labels of the axes and the plot title:

.. automethod:: PlotWidget.getGraphTitle
.. automethod:: PlotWidget.setGraphTitle
.. automethod:: PlotWidget.getGraphXLabel
.. automethod:: PlotWidget.setGraphXLabel
.. automethod:: PlotWidget.getGraphYLabel
.. automethod:: PlotWidget.setGraphYLabel

Axes limits
...........

Those methods change the range of data values displayed on each axis.

.. automethod:: PlotWidget.getGraphXLimits
.. automethod:: PlotWidget.setGraphXLimits
.. automethod:: PlotWidget.getGraphYLimits
.. automethod:: PlotWidget.setGraphYLimits
.. automethod:: PlotWidget.setLimits

Axes
....

The following methods handle the display properties of the axes:

.. automethod:: PlotWidget.isXAxisLogarithmic
.. automethod:: PlotWidget.setXAxisLogarithmic
.. automethod:: PlotWidget.isYAxisLogarithmic
.. automethod:: PlotWidget.setYAxisLogarithmic

.. automethod:: PlotWidget.isYAxisInverted
.. automethod:: PlotWidget.setYAxisInverted
.. automethod:: PlotWidget.isKeepDataAspectRatio
.. automethod:: PlotWidget.setKeepDataAspectRatio
.. automethod:: PlotWidget.getGraphGrid
.. automethod:: PlotWidget.setGraphGrid

Reset zoom
..........

.. automethod:: PlotWidget.resetZoom

Those methods change the behavior of :meth:`PlotWidget.resetZoom`.

.. automethod:: PlotWidget.getDataMargins
.. automethod:: PlotWidget.setDataMargins
.. automethod:: PlotWidget.isXAxisAutoScale
.. automethod:: PlotWidget.setXAxisAutoScale
.. automethod:: PlotWidget.isYAxisAutoScale
.. automethod:: PlotWidget.setYAxisAutoScale

Defaults
........

Those methods set-up default values for :meth:`PlotWidget.addCurve` and
:meth:`PlotWidget.addImage`:

.. automethod:: PlotWidget.getDefaultColormap
.. automethod:: PlotWidget.setDefaultColormap
.. automethod:: PlotWidget.getSupportedColormaps
.. automethod:: PlotWidget.setDefaultPlotPoints
.. automethod:: PlotWidget.setDefaultPlotLines

Interaction
...........

Those methods allow to change the interaction mode (e.g., drawing mode)
of the plot and to toggle the use of a crosshair cursor:

.. automethod:: PlotWidget.getInteractiveMode
.. automethod:: PlotWidget.setInteractiveMode

.. automethod:: PlotWidget.getGraphCursor
.. automethod:: PlotWidget.setGraphCursor

Misc.
.....

.. automethod:: PlotWidget.saveGraph

Signals
.......

The :class:`PlotWidget` provides the following Qt signals:

.. autoattribute:: PlotWidget.sigPlotSignal
.. autoattribute:: PlotWidget.sigSetYAxisInverted
.. autoattribute:: PlotWidget.sigSetXAxisLogarithmic
.. autoattribute:: PlotWidget.sigSetYAxisLogarithmic
.. autoattribute:: PlotWidget.sigSetXAxisAutoScale
.. autoattribute:: PlotWidget.sigSetYAxisAutoScale
.. autoattribute:: PlotWidget.sigSetKeepDataAspectRatio
.. autoattribute:: PlotWidget.sigSetGraphGrid
.. autoattribute:: PlotWidget.sigSetGraphCursor
.. autoattribute:: PlotWidget.sigSetPanWithArrowKeys
.. autoattribute:: PlotWidget.sigContentChanged
.. autoattribute:: PlotWidget.sigActiveCurveChanged
.. autoattribute:: PlotWidget.sigActiveImageChanged
.. autoattribute:: PlotWidget.sigInteractiveModeChanged

.. Not documented:
   addItem, removeItem, clearItems
   isActiveCurveHandling, enableActiveCurveHandling,
   getActiveCurveColor, setActiveCurveColor,
   getActiveCurve, setActiveCurve,
   isCurveHidden, hideCurve,
   getActiveImage, setActiveImage,
   getAllCurves, getCurve, getImage, getAllImages,
   getScatter, getHistogram,
   setDefaultPlotPoints, setDefaultPlotLines,
   getWidgetHandle, notify, setCallback, graphCallback,
   dataToPixel, pixelToData, getPlotBoundsInPixels,
   setGraphCursorShape, pickMarker, moveMarker, pickImageOrCurve, moveImage,
   onMousePress, onMouseMove, onMouseRelease, onMouseWheel,
   isDrawModeEnabled, setDrawModeEnabled, getDrawMode,
   isZoomModeEnabled, setZoomModeEnabled,