Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
fdcb3c5c
Commit
fdcb3c5c
authored
Apr 12, 2014
by
Luke Campagnola
Browse files
Added 'stepMode' argument to PlotDataItem()
Merge branch 'plotdataitem_stepmode' into develop
parents
c5d4c92a
98dec9e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
fdcb3c5c
...
...
@@ -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()
Bugfixes:
- PlotCurveItem now has correct clicking behavior--clicks within a few px
...
...
examples/histogram.py
View file @
fdcb3c5c
...
...
@@ -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
.
addItem
(
curve
)
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
)
...
...
pyqtgraph/graphicsItems/PlotDataItem.py
View file @
fdcb3c5c
...
...
@@ -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
=
{}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment