forked from cs573-22s/a2-DataVis-5ways
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyCode(plotly).py
More file actions
38 lines (33 loc) · 854 Bytes
/
pyCode(plotly).py
File metadata and controls
38 lines (33 loc) · 854 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
32
33
34
35
36
37
38
# https://stackoverflow.com/questions/60962274/plotly-how-to-change-the-colorscheme-of-a-plotly-express-scatterplot
# https://plotly.com/python/plotly-express/
# https://plotly.com/python/figure-labels/
# https://plotly.com/python/tick-formatting/#using-tickformat-attribute
#dir(px.colors.qualitative)
import pandas as pd
import plotly.express as px
file = pd.read_csv("cars-sample.csv")
img = px.scatter(
file,
x = 'Weight',
y = 'MPG',
color = 'Manufacturer',
color_discrete_sequence = px.colors.qualitative.Bold,
size = 'Weight',
size_max = 20
)
img.update_layout(
font=dict(
family="Courier New, monospace",
size=20,
color="Brown"
),
xaxis = dict(
tick0 = 2000,
dtick = 1000
),
yaxis = dict(
tick0 = 10,
dtick = 10
)
)
img.show()