Introduction to Data Visualization with Plotly in Python
Alex Scriven
Data Scientist
$$
| spec | av_flip_length |
|---|---|
| Adelie | 189.953642 |
| Chinstrap | 195.823529 |
| Gentoo | 217.186992 |
spec and av_flip_length columns$$
fig = px.bar(penguin_flippers,
x="spec",
y="av_flip_length")
fig.show()

plotly 'shortcut' functions: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"))
))

$$
update_layout() method for more control:$$
$$
See more on the Plotly documentation

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

What happens when some data points are much larger than others?

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


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

💡 Always consider the audience when choosing how to visualize data

Introduction to Data Visualization with Plotly in Python