Commit fdcb3c5c authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Added 'stepMode' argument to PlotDataItem()

Merge branch 'plotdataitem_stepmode' into develop
parents c5d4c92a 98dec9e9
......@@ -47,6 +47,7 @@ pyqtgraph-0.9.9 [unreleased]
- PeriodicTrace used to report deadlocks
- Added AxisItem.setStyle()
- Added configurable formatting for TableWidget
- Added 'stepMode' argument to PlotDataItem()
- PlotCurveItem now has correct clicking behavior--clicks within a few px
......@@ -2,8 +2,6 @@
In this example we draw two different kinds of histogram.
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
......@@ -22,11 +20,9 @@ vals = np.hstack([np.random.normal(size=500), np.random.normal(size=260, loc=4)]
## compute standard histogram
y,x = np.histogram(vals, bins=np.linspace(-3, 8, 40))
## Using stepMode=True causes the plot to draw two lines for each sample.
## notice that len(x) == len(y)+1
## We are required to use stepMode=True so that PlotCurveItem will interpret this data correctly.
curve = pg.PlotCurveItem(x, y, stepMode=True, fillLevel=0, brush=(0, 0, 255, 80))
plt1.plot(x, y, stepMode=True, fillLevel=0, brush=(0,0,255,150))
## Now draw all points as a nicely-spaced scatter plot
y = pg.pseudoScatter(vals, spacing=0.15)
......@@ -68,6 +68,10 @@ class PlotDataItem(GraphicsObject):
fillLevel Fill the area between the curve and fillLevel
fillBrush Fill to use when fillLevel is specified.
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`
(added in version 0.9.9)
========== ==============================================================================
**Point style keyword arguments:** (see :func:`ScatterPlotItem.setData() <pyqtgraph.ScatterPlotItem.setData>` for more information)
......@@ -150,6 +154,7 @@ class PlotDataItem(GraphicsObject):
'shadowPen': None,
'fillLevel': None,
'fillBrush': None,
'stepMode': None,
'symbol': None,
'symbolSize': 10,
......@@ -456,7 +461,7 @@ class PlotDataItem(GraphicsObject):
def updateItems(self):
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]
scatterArgs = {}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment