
In this post, you will learn how to create a Dot plot in Plotly Python.
1 . Create a Dot plot with Plotly Express –
Dot plots (also known as Cleveland dot plots) are scatter plots with one categorical axis and one continuous axis. They can be used to show changes between two (or more) points in time or between two (or more) conditions. Compared to a bar chart, dot plots can be less cluttered and allow for an easier comparison between conditions.
Let’s read a dataset
import pandas as pd
url = "https://raw.githubusercontent.com/bprasad26/lwd/master/data/BestPayingDegrees.csv"
df = pd.read_csv(url)
df.head()

To create a Dot plot in plotly express we use the px.scatter() method.
import plotly.express as px
fig = px.scatter(df, y='Degree', x='Starting Salary')
fig.update_layout(title="Earnings By Degree")
fig.show()

2 . Create a Dot Plot with Plotly Graph Objects –
To create a Dot plot with Plotly Graph Objects, we use the go.Scatter() method.
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(y=df['Degree'], x=df['Starting Salary'],mode='markers',
marker={'color':'crimson','size': 12}))
fig.update_layout(title="Earnings By Degree",
xaxis_title="Starting Salary",
yaxis_title="Degree")
fig.show()

Related Posts –
1 . How to install plotly python with pip
2 . How to create a Line Chart with Plotly Python
3 . How to create Scatter plot in Plotly Python
4 . How to create a Bar Chart in Plotly Python
5 . How to create Horizontal Bar Chart in Plotly Python
6 . How to create a Histogram in plotly python
7 . How to Create a Box Plot in Plotly Python
8 . How to create a Pie Chart in Plotly Python
9 . How to Create Heatmap with Plotly Python
10 . How to Create a Violin Plot in Plotly Python
11 . How to Create Subplots in Plotly Python