-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.py
More file actions
31 lines (25 loc) · 914 Bytes
/
default.py
File metadata and controls
31 lines (25 loc) · 914 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
"""
histogram-basic: Basic Histogram
Library: plotly
"""
import numpy as np
import plotly.graph_objects as go
# Data
np.random.seed(42)
values = np.random.normal(100, 15, 500) # 500 values, mean=100, std=15
# Create figure
fig = go.Figure()
fig.add_trace(go.Histogram(x=values, marker={"color": "#306998", "line": {"color": "white", "width": 1}}, opacity=0.85))
# Layout
fig.update_layout(
title={"text": "Basic Histogram", "font": {"size": 40}, "x": 0.5, "xanchor": "center"},
xaxis_title="Value",
yaxis_title="Frequency",
template="plotly_white",
font={"size": 32},
xaxis={"title_font": {"size": 40}, "tickfont": {"size": 32}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
yaxis={"title_font": {"size": 40}, "tickfont": {"size": 32}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
bargap=0.05,
)
# Save
fig.write_image("plot.png", width=1600, height=900, scale=3)