-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.py
More file actions
30 lines (25 loc) · 701 Bytes
/
default.py
File metadata and controls
30 lines (25 loc) · 701 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
"""
histogram-basic: Basic Histogram
Library: plotnine
"""
import numpy as np
import pandas as pd
from plotnine import aes, element_text, geom_histogram, ggplot, labs, theme, theme_minimal
# Data
np.random.seed(42)
data = pd.DataFrame({"value": np.random.normal(100, 15, 500)})
# Plot
plot = (
ggplot(data, aes(x="value"))
+ geom_histogram(bins=30, fill="#306998", color="white", alpha=0.8)
+ labs(x="Value", y="Frequency", title="Basic Histogram")
+ theme_minimal()
+ theme(
figure_size=(16, 9),
plot_title=element_text(size=20),
axis_title=element_text(size=20),
axis_text=element_text(size=16),
)
)
# Save
plot.save("plot.png", dpi=300)