-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.py
More file actions
41 lines (34 loc) · 1.02 KB
/
default.py
File metadata and controls
41 lines (34 loc) · 1.02 KB
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
32
33
34
35
36
37
38
39
40
41
"""
scatter-basic: Basic Scatter Plot
Library: plotly
"""
import numpy as np
import plotly.graph_objects as go
# Data
np.random.seed(42)
x = np.random.randn(100) * 2 + 10
y = x * 0.8 + np.random.randn(100) * 2
# Create figure
fig = go.Figure()
fig.add_trace(go.Scatter(x=x, y=y, mode="markers", marker={"size": 12, "color": "#306998", "opacity": 0.7}))
# Layout
fig.update_layout(
title={"text": "Basic Scatter Plot", "font": {"size": 40}, "x": 0.5, "xanchor": "center"},
xaxis={
"title": {"text": "X Value", "font": {"size": 40}},
"tickfont": {"size": 32},
"showgrid": True,
"gridcolor": "rgba(0, 0, 0, 0.1)",
},
yaxis={
"title": {"text": "Y Value", "font": {"size": 40}},
"tickfont": {"size": 32},
"showgrid": True,
"gridcolor": "rgba(0, 0, 0, 0.1)",
},
template="plotly_white",
plot_bgcolor="white",
margin={"l": 120, "r": 50, "t": 100, "b": 100},
)
# Save (4800 x 2700 px)
fig.write_image("plot.png", width=1600, height=900, scale=3)