Introduction to Data Visualization with Plotly in Python
Alex Scriven
Data Scientist
$$
$$
import plotly.express as px
fig = px.scatter( data_frame=penguins, x="Body Mass (g)", y="Flipper Length (mm)") fig.show()
Useful plotly.express
scatterplot arguments:
trendline
: Add different types of trend linessymbol
: Set different symbols for different categories$$
$$
$$
Check the documentation for more
$$
fig = px.line(
data_frame=msft_stock,
x="Date",
y="Open",
title="MSFT Stock Price (5Y)")
fig.show()
$$
$$
The Pearson Correlation Coefficient:
df
contains data on bike rental numbers and weather conditions
cr = df.corr(method="pearson")
print(cr)
$$
fig = px.imshow(
cr,
text_auto=True,
color_continuous_scale="RdYlGn", zmin=-1, zmax=1)
fig.show()
Introduction to Data Visualization with Plotly in Python