Skip to content
Advertisement

How do I convert this histogram into a dot plot/dot chart using matplotlib and numpy?

I’m trying to create a dot plot/dot chart based on students’ hours of sleep, but the closest I was able to get was a histogram which matched my data. The method I tried which will be provided below didn’t work for me either due to my sheer inexperience or incompatibility with my data. Any help would be greatly appreciated.

I’ve already tried a similar answer which was this: How to create a “dot plot” in Matplotlib? (not a scatter plot)

This method rounded the float values in hours of sleep up, which was making the plot incorrect, or perhaps I was just using it wrong. I would appreciate a solution using my exact example, because I’m still pretty new to programming and likely won’t understand much else.

JavaScript

I want to end up with something similar to the dot plot example provided by the user who asked the question in the link I’ve already provided.

Advertisement

Answer

I feel that this answers your question: How to create a “dot plot” in Matplotlib? (not a scatter plot)

I’m using more or less the same method.

JavaScript

Alternative Method

JavaScript

Hope this helps. :)
Reading some Matplotlib Documentations will help you too.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement