Data Visualization with plotly#
Installation#
You can install Plotly using pip or conda:
pip install plotly
conda install -c plotly plotly=5.18.0
Import plotly#
To use plotly in your code, you need to import it:
import plotly.express as px
Create a simple scatter plot#
We are using the Iris dataset that are built-in in the package as an example.
df = px.data.iris() # the iris dataset is built-in
fig = px.scatter(df, x="sepal_width", y="sepal_length")
fig.show()
Create a bar chart#
df = px.data.tips() # the tips dataset is built-in
fig = px.bar(df, x="day", y="total_bill")
fig.show()
Creating a Box Plot#
df = px.data.tips() # the tips dataset is built-in
fig = px.box(df, x="day", y="total_bill")
fig.show()
Creating a Histogram#
df = px.data.tips() # the tips dataset is built-in
fig = px.histogram(df, x="total_bill")
fig.show()
There are many more features and chart types which you can explore in their official documentation.