Python 的 Plotly 資料視覺化入門
Alex Scriven
Data Scientist
$$
| spec | av_flip_length |
|---|---|
| Adelie | 189.953642 |
| Chinstrap | 195.823529 |
| Gentoo | 217.186992 |
spec 和 av_flip_length 欄位$$
fig = px.bar(penguin_flippers,
x="spec",
y="av_flip_length")
fig.show()

plotly 的「捷徑」函式:fig.update_xaxes(title_text="Species")
fig.update_yaxes(title_text="Average Flipper Length")
$$
update_layout() 實作fig.update_layout(dict(
xaxis=dict(title=dict(text="Species")),
yaxis=dict(title=dict(text="Average Flipper Length"))
))


fig.update_layout(dict(
yaxis=dict(range=[150, penguin_flippers["av_flip_length"].max() + 30]
)))

當部分資料點比其他點大「很多」時會怎樣?

fig = px.bar(billionaire_data,
x="Country",
y="Number Billionaires")
fig.show()


$$
log_y 和 log_x 參數fig = px.bar(billionaire_data,
x="Country",
y="Number Billionaires",
log_y=True)
fig.show()
$$

💡 視覺化方式要以受眾為先

Python 的 Plotly 資料視覺化入門