Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How to plot a histogram using Matplotlib in Python with a list of data?

Asked by Ajit Yadav Apr 14, 2021 1.4K views 1 answer
Share

About this question

I am trying to plot a histogram using the matplotlib.hist() function but I am not sure how to do it.

I have a list

probability = [0.3602150537634409, 0.42028985507246375, 0.373117033603708, 0.36813186813186816, 0.32517482517482516, 0.4175257731958763, 0.41025641025641024, 0.39408866995073893, 0.4143222506393862, 0.34, 0.391025641025641, 0.3130841121495327, 0.35398230088495575]

and a list of names(strings).

How do I make the probability as my y-value of each bar and names as x-values?

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.