FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
finplot/finplot/examples/line.py at master · robot-python/finplot · GitHub
robot-python
/
finplot
Public
forked from
highfestiva/finplot
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
finplot
/
finplot
/
examples
/
line.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (17 loc) · 777 Bytes
Breadcrumbs
finplot
/
finplot
/
examples
/
line.py
Copy path
File metadata and controls
22 lines (17 loc) · 777 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3
import
finplot
as
fplt
import
numpy
as
np
import
pandas
as
pd
dates
=
pd
.
date_range
(
'01:00'
,
'01:00:01.200'
,
freq
=
'1ms'
)
prices
=
pd
.
Series
(
np
.
random
.
random
(
len
(
dates
))).
rolling
(
30
).
mean
()
+
4
fplt
.
plot
(
dates
,
prices
,
width
=
3
)
line
=
fplt
.
add_line
((
dates
[
100
],
4.4
), (
dates
[
len
(
dates
)
-
10
],
4.6
),
color
=
'#9900ff'
,
interactive
=
True
)
## fplt.remove_primitive(line)
text
=
fplt
.
add_text
((
dates
[
500
],
4.6
),
"I'm here alright!"
,
color
=
'#bb7700'
)
## fplt.remove_primitive(text)
rect
=
fplt
.
add_rect
((
dates
[
700
],
4.5
), (
dates
[
850
],
4.4
),
color
=
'#8c8'
,
interactive
=
True
)
## fplt.remove_primitive(rect)
def
save
():
fplt
.
screenshot
(
open
(
'screenshot.png'
,
'wb'
))
fplt
.
timer_callback
(
save
,
0.5
,
single_shot
=
True
)
# wait some until we're rendered
fplt
.
show
()
Back
|
FazBrowse Home
|
New Git URL