Skip to content

Commit 4882920

Browse files
feat(plotly): implement histogram-basic (#466)
## Summary Implements `histogram-basic` for **plotly** library. **Parent Issue:** #206 **Sub-Issue:** #426 **Base Branch:** `plot/histogram-basic` **Attempt:** 1/3 ## Implementation - `plots/plotly/histogram/histogram-basic/default.py` ## Features - Basic histogram visualization using `go.Histogram` - Sample data: 500 values from normal distribution (mean=100, std=15) - Python Blue color palette (#306998) with white bar outlines - Proper typography for 4800x2700 output (40pt titles, 32pt labels) - Clean `plotly_white` template with subtle grid styling - 5% bar gap for visual clarity Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
1 parent 99c4fc5 commit 4882920

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

plots/plotly/histogram/histogram-basic/default.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,21 @@
99

1010
# Data
1111
np.random.seed(42)
12-
values = np.random.normal(100, 15, 500)
12+
values = np.random.normal(100, 15, 500) # 500 values, mean=100, std=15
1313

1414
# Create figure
1515
fig = go.Figure()
16-
fig.add_trace(
17-
go.Histogram(
18-
x=values, marker_color="#306998", opacity=0.85, hovertemplate="Range: %{x}<br>Count: %{y}<extra></extra>"
19-
)
20-
)
16+
fig.add_trace(go.Histogram(x=values, marker={"color": "#306998", "line": {"color": "white", "width": 1}}, opacity=0.85))
2117

2218
# Layout
2319
fig.update_layout(
2420
title={"text": "Basic Histogram", "font": {"size": 40}, "x": 0.5, "xanchor": "center"},
25-
xaxis_title={"text": "Value", "font": {"size": 40}},
26-
yaxis_title={"text": "Frequency", "font": {"size": 40}},
21+
xaxis_title="Value",
22+
yaxis_title="Frequency",
2723
template="plotly_white",
28-
xaxis={"tickfont": {"size": 32}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
29-
yaxis={"tickfont": {"size": 32}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
24+
font={"size": 32},
25+
xaxis={"title_font": {"size": 40}, "tickfont": {"size": 32}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
26+
yaxis={"title_font": {"size": 40}, "tickfont": {"size": 32}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
3027
bargap=0.05,
3128
)
3229

0 commit comments

Comments
 (0)