Home > Software design >  How to create a dot plot (not scatter plot) from this data?
How to create a dot plot (not scatter plot) from this data?

Time:11-14

I need help creating a dot plot in Python like the one from the image. The exercise consists on graphing the following data 74.001 , 74.003, 74.015, 74.000, 74.005, 74.004. I'm having some trouble with doing the dot plot because I can't find how to do it.

enter image description here

CodePudding user response:

Here you go:

import matplotlib.pyplot as plt
y =[74.001 , 74.003, 74.015, 74.000, 74.005, 74.004]
fig = plt.plot(y,'o', fillstyle='none')

enter image description here

Next time you post a question, include a MRE (Minimum Reproducible Example) showing what you have done.

CodePudding user response:

Using plotly and also defining x which was not provided.

import plotly.express as px
y =[74.001 , 74.003, 74.015, 74.000, 74.005, 74.004]
x =[12.4,12.5,12.5,12.6,12.7, 12.8]
px.scatter(x=x, y=y).update_traces(marker_symbol="circle-open", marker_line_width=3)

enter image description here

  • Related