import
pyqtgraph as pg
from
pyqtgraph.Qt
import
QtCore, QtGui
import
numpy as np
title
=
"GeeksforGeeks PyQtGraph"
y
=
[
2
,
8
,
6
,
8
,
6
,
11
,
14
,
13
,
18
,
19
]
y2
=
[
3
,
1
,
5
,
8
,
9
,
11
,
16
,
17
,
14
,
16
]
x
=
range
(
0
,
10
)
plt
=
pg.plot()
plt.showGrid(x
=
True
, y
=
True
)
plt.addLegend()
plt.setLabel(
'left'
,
'Vertical Values'
, units
=
'y'
)
plt.setLabel(
'bottom'
,
'Horizontal Values'
, units
=
's'
)
plt.setXRange(
0
,
10
)
plt.setYRange(
0
,
20
)
plt.setWindowTitle(title)
line1
=
plt.plot(x, y, pen
=
'g'
, symbol
=
'x'
, symbolPen
=
'g'
, symbolBrush
=
0.2
, name
=
'green'
)
line2
=
plt.plot(x, y2, pen
=
'b'
, symbol
=
'o'
, symbolPen
=
'b'
, symbolBrush
=
0.2
, name
=
'blue'
)
if
__name__
=
=
'__main__'
:
import
sys
if
(sys.flags.interactive !
=
1
)
or
not
hasattr
(QtCore,
'PYQT_VERSION'
):
QtGui.QApplication.instance().exec_()