-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.py
More file actions
39 lines (33 loc) · 831 Bytes
/
default.py
File metadata and controls
39 lines (33 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
line-basic: Basic Line Plot
Library: letsplot
"""
import pandas as pd
from lets_plot import (
LetsPlot,
aes,
element_text,
geom_line,
geom_point,
ggplot,
ggsave,
ggsize,
labs,
theme,
theme_minimal,
)
LetsPlot.setup_html()
# Data
data = pd.DataFrame({"time": [1, 2, 3, 4, 5, 6, 7], "value": [10, 15, 13, 18, 22, 19, 25]})
# Plot
plot = (
ggplot(data, aes(x="time", y="value"))
+ geom_line(color="#306998", size=2)
+ geom_point(color="#306998", size=4, alpha=0.8)
+ labs(x="Time", y="Value", title="Basic Line Plot")
+ theme_minimal()
+ theme(plot_title=element_text(size=20), axis_title=element_text(size=20), axis_text=element_text(size=16))
+ ggsize(1600, 900)
)
# Save (scale 3x to get 4800 × 2700 px)
ggsave(plot, "plot.png", path=".", scale=3)