Skip to content

Commit 351e94b

Browse files
feat(letsplot): implement bar-basic
1 parent 27357ca commit 351e94b

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
bar-basic: Basic Bar Chart
3+
Library: letsplot
4+
"""
5+
6+
import pandas as pd
7+
from lets_plot import LetsPlot, aes, element_text, geom_bar, ggplot, ggsave, ggsize, labs, theme, theme_minimal
8+
9+
10+
LetsPlot.setup_html()
11+
12+
# Data
13+
data = pd.DataFrame(
14+
{"category": ["Product A", "Product B", "Product C", "Product D", "Product E"], "value": [45, 78, 52, 91, 63]}
15+
)
16+
17+
# Plot
18+
plot = (
19+
ggplot(data, aes(x="category", y="value"))
20+
+ geom_bar(stat="identity", fill="#306998", alpha=0.9)
21+
+ labs(x="Category", y="Value", title="Basic Bar Chart")
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 × 2700 px)
28+
ggsave(plot, "plot.png", path=".", scale=3)

0 commit comments

Comments
 (0)