summaryrefslogtreecommitdiff
path: root/doc/source/modules/gui/plot/plotwidget.rst
blob: 9978479a2ec2a04aca503b618d3f4dce8ff35890 (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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
.. 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`.

:class:`PlotWidget`
-------------------

.. 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

Get data
........

Those methods return objects providing access to plotted data:

.. automethod:: PlotWidget.getItems

.. automethod:: PlotWidget.getCurve
.. automethod:: PlotWidget.getImage
.. automethod:: PlotWidget.getScatter
.. automethod:: PlotWidget.getHistogram

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
.....

Those methods handle the plot title:

.. automethod:: PlotWidget.getGraphTitle
.. automethod:: PlotWidget.setGraphTitle

Axes
....

Those two methods give access to :class:`.items.Axis` which handle the limits, scales and labels of axis:

.. automethod:: PlotWidget.getXAxis
.. automethod:: PlotWidget.getYAxis

The following methods handle plot limits, aspect ratio, grid and axes display:

.. automethod:: PlotWidget.setLimits
.. automethod:: PlotWidget.isKeepDataAspectRatio
.. automethod:: PlotWidget.setKeepDataAspectRatio
.. automethod:: PlotWidget.getGraphGrid
.. automethod:: PlotWidget.setGraphGrid
.. automethod:: PlotWidget.setAxesDisplayed

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

.. automethod:: PlotWidget.resetZoom

The following methods allow to add margins around the data when performing a zoom reset:

.. automethod:: PlotWidget.getDataMargins
.. automethod:: PlotWidget.setDataMargins

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

.. automethod:: PlotWidget.isPanWithArrowKeys
.. automethod:: PlotWidget.setPanWithArrowKeys

Coordinates conversion
......................

.. automethod:: PlotWidget.getDataRange
.. automethod:: PlotWidget.getPlotBoundsInPixels
.. automethod:: PlotWidget.dataToPixel
.. automethod:: PlotWidget.pixelToData

Active Item
...........

.. automethod:: PlotWidget.setActiveCurveSelectionMode
.. automethod:: PlotWidget.getActiveCurveSelectionMode
.. automethod:: PlotWidget.getActiveCurveStyle
.. automethod:: PlotWidget.setActiveCurveStyle
.. automethod:: PlotWidget.getActiveCurve
.. automethod:: PlotWidget.setActiveCurve
.. automethod:: PlotWidget.getActiveImage
.. automethod:: PlotWidget.setActiveImage

Misc.
.....

.. automethod:: PlotWidget.getWidgetHandle
.. automethod:: PlotWidget.saveGraph

Signals
.......

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

.. autoattribute:: PlotWidget.sigPlotSignal
.. autoattribute:: PlotWidget.sigSetKeepDataAspectRatio
.. autoattribute:: PlotWidget.sigSetGraphGrid
.. autoattribute:: PlotWidget.sigSetGraphCursor
.. autoattribute:: PlotWidget.sigSetPanWithArrowKeys
.. autoattribute:: PlotWidget.sigItemAdded
.. autoattribute:: PlotWidget.sigItemAboutToBeRemoved
.. autoattribute:: PlotWidget.sigContentChanged
.. autoattribute:: PlotWidget.sigActiveCurveChanged
.. autoattribute:: PlotWidget.sigActiveImageChanged
.. autoattribute:: PlotWidget.sigActiveScatterChanged
.. autoattribute:: PlotWidget.sigInteractiveModeChanged

.. toctree::
   :hidden:

   plotsignal.rst

.. PlotWidget public API that is not documented:
   Could be added:
   - addItem
   - pan
   - getLimitsHistory
   - isDefaultPlotPoints
   - isDefaultPlotLines
   - setGraphCursorShape
   - getAutoReplot, setAutoReplot, replot
   Should not be added:
   * Should be private:
     - notify, setCallback, graphCallback
   * Use remove instead:
     - removeCurve, removeImage, removeItem, removeMarker
     - clearCurves, clearImages, clearItems, clearMarkers
   * Use items instead:
     - isCurveHidden, hideCurve
   * Use items.axis instead:
     - getGraphXLimits, setGraphXLimits
     - getGraphYLimits, setGraphYLimits
     - getGraphXLabel, setGraphXLabel
     - getGraphYLabel, setGraphYLabel
     - isXAxisLogarithmic, setXAxisLogarithmic
     - isYAxisLogarithmic, setXAxisLogarithmic
     - isXAxisAutoScale, setXAxisAutoScale
     - isYAxisAutoScale, setYAxisAutoScale
     - setYAxisInverted, isYAxisInverted