-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.py
More file actions
31 lines (24 loc) · 795 Bytes
/
default.py
File metadata and controls
31 lines (24 loc) · 795 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
"""
scatter-basic: Basic Scatter Plot
Library: letsplot
"""
import numpy as np
import pandas as pd
from lets_plot import LetsPlot, aes, element_text, geom_point, ggplot, ggsave, ggsize, labs, theme, theme_minimal
LetsPlot.setup_html()
# Data
np.random.seed(42)
x = np.random.randn(100) * 2 + 10
y = x * 0.8 + np.random.randn(100) * 2
data = pd.DataFrame({"x": x, "y": y})
# Plot
plot = (
ggplot(data, aes(x="x", y="y"))
+ geom_point(color="#306998", size=4, alpha=0.7)
+ labs(x="X Value", y="Y Value", title="Basic Scatter Plot")
+ ggsize(1600, 900)
+ theme_minimal()
+ theme(plot_title=element_text(size=20), axis_title=element_text(size=20), axis_text=element_text(size=16))
)
# Save (scale 3x to get 4800 × 2700 px)
ggsave(plot, "plot.png", path=".", scale=3)