Skip to content

Commit 39ee688

Browse files
feat(letsplot): implement histogram-basic
1 parent 27357ca commit 39ee688

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

  • plots/letsplot/histogram/histogram-basic
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
histogram-basic: Basic Histogram
3+
Library: letsplot
4+
"""
5+
6+
import numpy as np
7+
import pandas as pd
8+
from lets_plot import LetsPlot, aes, element_text, geom_histogram, ggplot, ggsave, ggsize, labs, theme, theme_minimal
9+
10+
11+
LetsPlot.setup_html()
12+
13+
# Data
14+
np.random.seed(42)
15+
data = pd.DataFrame({"value": np.random.normal(100, 15, 500)})
16+
17+
# Plot
18+
plot = (
19+
ggplot(data, aes(x="value"))
20+
+ geom_histogram(bins=30, fill="#306998", color="white", alpha=0.8)
21+
+ labs(x="Value", y="Frequency", title="Basic Histogram")
22+
+ theme_minimal()
23+
+ theme(plot_title=element_text(size=20), axis_title=element_text(size=20), axis_text=element_text(size=16))
24+
+ ggsize(1600, 900)
25+
)
26+
27+
# Save - scale 3x to get 4800 x 2700 px
28+
ggsave(plot, "plot.png", path=".", scale=3)

0 commit comments

Comments
 (0)