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
d800ab03
Commit
d800ab03
authored
Nov 28, 2012
by
Luke Campagnola
Browse files
Added graphics item for drawing filled space between two plots
parent
00516042
Changes
1
Hide whitespace changes
Inline
Side-by-side
graphicsItems/FillBetweenItem.py
0 → 100644
View file @
d800ab03
import
pyqtgraph
as
pg
class
FillBetweenItem
(
pg
.
QtGui
.
QGraphicsPathItem
):
"""
GraphicsItem filling the space between two PlotDataItems.
"""
def
__init__
(
self
,
p1
,
p2
,
brush
=
None
):
pg
.
QtGui
.
QGraphicsPathItem
.
__init__
(
self
)
self
.
p1
=
p1
self
.
p2
=
p2
p1
.
sigPlotChanged
.
connect
(
self
.
updatePath
)
p2
.
sigPlotChanged
.
connect
(
self
.
updatePath
)
if
brush
is
not
None
:
self
.
setBrush
(
pg
.
mkBrush
(
brush
))
self
.
setZValue
(
min
(
p1
.
zValue
(),
p2
.
zValue
())
-
1
)
self
.
updatePath
()
def
updatePath
(
self
):
p1
=
self
.
p1
.
curve
.
path
p2
=
self
.
p2
.
curve
.
path
path
=
pg
.
QtGui
.
QPainterPath
()
path
.
addPolygon
(
p1
.
toSubpathPolygons
()[
0
]
+
p2
.
toReversed
().
toSubpathPolygons
()[
0
])
self
.
setPath
(
path
)
Write
Preview
Markdown
is supported
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