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
fcf2c53c
Commit
fcf2c53c
authored
Mar 17, 2012
by
Luke Campagnola
Browse files
Example updates
parent
7401d3f3
Changes
9
Hide whitespace changes
Inline
Side-by-side
examples/Arrow.py
View file @
fcf2c53c
# -*- coding: utf-8 -*-
## Display an animated arrowhead following a curve.
## This example uses the CurveArrow class, which is a combination
## of ArrowItem and CurvePoint.
##
## To place a static arrow anywhere in a scene, use ArrowItem.
## To attach other types of item to a curve, use CurvePoint.
## Add path to library (just for examples; you do not need this)
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
import
initExample
## Add path to library (just for examples; you do not need this)
import
numpy
as
np
from
pyqtgraph.Qt
import
QtGui
,
QtCore
...
...
@@ -23,6 +31,6 @@ mw.show()
anim
=
a
.
makeAnimation
(
loop
=-
1
)
anim
.
start
()
## Start Qt event loop unless running in interactive mode.
if
sys
.
flags
.
interactive
!=
1
:
## Start Qt event loop unless running in interactive mode
or using pyside
.
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
)
:
app
.
exec_
()
examples/CLIexample.py
View file @
fcf2c53c
## Add path to library (just for examples; you do not need this)
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
import
initExample
## Add path to library (just for examples; you do not need this)
from
pyqtgraph.Qt
import
QtGui
,
QtCore
import
numpy
as
np
...
...
@@ -17,6 +14,7 @@ data = np.random.normal(size=(500,500))
pg
.
show
(
data
,
title
=
"Simplest possible image example"
)
## Start Qt event loop unless running in interactive mode.
if
sys
.
flags
.
interactive
!=
1
:
## Start Qt event loop unless running in interactive mode or using pyside.
import
sys
if
sys
.
flags
.
interactive
!=
1
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
app
.
exec_
()
examples/Draw.py
View file @
fcf2c53c
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
import
initExample
## Add path to library (just for examples; you do not need this)
from
pyqtgraph.Qt
import
QtCore
,
QtGui
...
...
@@ -39,6 +37,6 @@ kern = np.array([
img
.
setDrawKernel
(
kern
,
mask
=
kern
,
center
=
(
1
,
1
),
mode
=
'add'
)
img
.
setLevels
([
0
,
10
])
## Start Qt event loop unless running in interactive mode.
if
sys
.
flags
.
interactive
!=
1
:
## Start Qt event loop unless running in interactive mode
or using pyside
.
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
)
:
app
.
exec_
()
examples/ImageItem.py
View file @
fcf2c53c
...
...
@@ -11,11 +11,8 @@ import pyqtgraph.ptime as ptime
app
=
QtGui
.
QApplication
([])
## Create window with GraphicsView widget
win
=
QtGui
.
QMainWindow
()
win
.
resize
(
800
,
800
)
view
=
pg
.
GraphicsView
()
win
.
setCentralWidget
(
view
)
win
.
show
()
view
.
show
()
## show view alone in its own window
## Allow mouse scale/pan. Normally we use a ViewBox for this, but
## for simple examples this is easier.
...
...
examples/PlotWidget.py
View file @
fcf2c53c
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
import
initExample
## Add path to library (just for examples; you do not need this)
from
pyqtgraph.Qt
import
QtGui
,
QtCore
...
...
@@ -82,6 +79,9 @@ line = pg.InfiniteLine(angle=90, movable=True)
pw3
.
addItem
(
line
)
line
.
setBounds
([
0
,
200
])
## Start Qt event loop unless running in interactive mode.
if
sys
.
flags
.
interactive
!=
1
:
import
initExample
## Add path to library (just for examples; you do not need this)
## Start Qt event loop unless running in interactive mode or using pyside.
import
sys
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
app
.
exec_
()
examples/Plotting.py
View file @
fcf2c53c
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
## This example demonstrates many of the 2D plotting capabilities
## in pyqtgraph. All of the plots may be panned/scaled by dragging with
## the left/right mouse buttons. Right click on any plot to show a context menu.
import
initExample
## Add path to library (just for examples; you do not need this)
from
pyqtgraph.Qt
import
QtGui
,
QtCore
...
...
@@ -82,6 +85,8 @@ def update():
lr
.
sigRegionChanged
.
connect
(
update
)
update
()
## Start Qt event loop unless running in interactive mode.
if
sys
.
flags
.
interactive
!=
1
:
## Start Qt event loop unless running in interactive mode or using pyside.
import
sys
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
app
.
exec_
()
examples/initExample.py
0 → 100644
View file @
fcf2c53c
## make this version of pyqtgraph importable before any others
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
examples/template.py
0 → 100644
View file @
fcf2c53c
# -*- coding: utf-8 -*-
import
initExample
## Add path to library (just for examples; you do not need this)
import
pyqtgraph
as
pg
from
pyqtgraph.Qt
import
QtCore
,
QtGui
import
numpy
as
np
## Start Qt event loop unless running in interactive mode or using pyside.
import
sys
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
QtGui
.
QApplication
.
instance
().
exec_
()
examples/text.py
0 → 100644
View file @
fcf2c53c
# -*- coding: utf-8 -*-
## This example shows how to insert text into a scene using QTextItem
import
initExample
## Add path to library (just for examples; you do not need this)
import
pyqtgraph
as
pg
from
pyqtgraph.Qt
import
QtCore
,
QtGui
import
numpy
as
np
x
=
np
.
linspace
(
-
100
,
100
,
1000
)
y
=
np
.
sin
(
x
)
/
x
plot
=
pg
.
plot
(
x
,
y
)
## Create text object, use HTML tags to specify color (default is black; won't be visible)
text
=
pg
.
TextItem
(
html
=
'<div style="text-align: center"><span style="color: #FFF;">This is the</span><br><span style="color: #FF0;">PEAK</span></div>'
)
plot
.
addItem
(
text
)
text
.
setPos
(
0
,
y
.
max
())
## Start Qt event loop unless running in interactive mode or using pyside.
import
sys
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
QtGui
.
QApplication
.
instance
().
exec_
()
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