PlotDataItem: add missing 'stepMode' keyword argument for PlotCurveItem

This commit is contained in:
Mikhail Terekhov 2014-04-12 15:31:20 -04:00
parent 62b506c63c
commit ac90bf4c3b
2 changed files with 9 additions and 3 deletions

View File

@ -15,6 +15,7 @@ win.resize(800,350)
win.setWindowTitle('pyqtgraph example: Histogram') win.setWindowTitle('pyqtgraph example: Histogram')
plt1 = win.addPlot() plt1 = win.addPlot()
plt2 = win.addPlot() plt2 = win.addPlot()
plt3 = win.addPlot()
## make interesting distribution of values ## make interesting distribution of values
vals = np.hstack([np.random.normal(size=500), np.random.normal(size=260, loc=4)]) vals = np.hstack([np.random.normal(size=500), np.random.normal(size=260, loc=4)])
@ -27,11 +28,12 @@ y,x = np.histogram(vals, bins=np.linspace(-3, 8, 40))
curve = pg.PlotCurveItem(x, y, stepMode=True, fillLevel=0, brush=(0, 0, 255, 80)) curve = pg.PlotCurveItem(x, y, stepMode=True, fillLevel=0, brush=(0, 0, 255, 80))
plt1.addItem(curve) plt1.addItem(curve)
plt2.plot(x, y, stepMode=True, fillLevel=0, brush=(0,0,255,150))
## Now draw all points as a nicely-spaced scatter plot ## Now draw all points as a nicely-spaced scatter plot
y = pg.pseudoScatter(vals, spacing=0.15) y = pg.pseudoScatter(vals, spacing=0.15)
#plt2.plot(vals, y, pen=None, symbol='o', symbolSize=5) #plt3.plot(vals, y, pen=None, symbol='o', symbolSize=5)
plt2.plot(vals, y, pen=None, symbol='o', symbolSize=5, symbolPen=(255,255,255,200), symbolBrush=(0,0,255,150)) plt3.plot(vals, y, pen=None, symbol='o', symbolSize=5, symbolPen=(255,255,255,200), symbolBrush=(0,0,255,150))
## Start Qt event loop unless running in interactive mode or using pyside. ## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -68,6 +68,9 @@ class PlotDataItem(GraphicsObject):
fillLevel Fill the area between the curve and fillLevel fillLevel Fill the area between the curve and fillLevel
fillBrush Fill to use when fillLevel is specified. fillBrush Fill to use when fillLevel is specified.
May be any single argument accepted by :func:`mkBrush() <pyqtgraph.mkBrush>` May be any single argument accepted by :func:`mkBrush() <pyqtgraph.mkBrush>`
stepMode If True, two orthogonal lines are drawn for each sample
as steps. This is commonly used when drawing histograms.
Note that in this case, len(x) == len(y) + 1
========== ============================================================================== ========== ==============================================================================
**Point style keyword arguments:** (see :func:`ScatterPlotItem.setData() <pyqtgraph.ScatterPlotItem.setData>` for more information) **Point style keyword arguments:** (see :func:`ScatterPlotItem.setData() <pyqtgraph.ScatterPlotItem.setData>` for more information)
@ -150,6 +153,7 @@ class PlotDataItem(GraphicsObject):
'shadowPen': None, 'shadowPen': None,
'fillLevel': None, 'fillLevel': None,
'fillBrush': None, 'fillBrush': None,
'stepMode': None,
'symbol': None, 'symbol': None,
'symbolSize': 10, 'symbolSize': 10,
@ -456,7 +460,7 @@ class PlotDataItem(GraphicsObject):
def updateItems(self): def updateItems(self):
curveArgs = {} curveArgs = {}
for k,v in [('pen','pen'), ('shadowPen','shadowPen'), ('fillLevel','fillLevel'), ('fillBrush', 'brush'), ('antialias', 'antialias'), ('connect', 'connect')]: for k,v in [('pen','pen'), ('shadowPen','shadowPen'), ('fillLevel','fillLevel'), ('fillBrush', 'brush'), ('antialias', 'antialias'), ('connect', 'connect'), ('stepMode', 'stepMode')]:
curveArgs[v] = self.opts[k] curveArgs[v] = self.opts[k]
scatterArgs = {} scatterArgs = {}