Using matplotlib how could I plot a histogram with given data in python

histogram, matplotlib, plot, python

Solution

You can create a barchart like this:

from matplotlib.pyplot import *
x = [111,122,155,192,11,123,120,]
y = [3,4,3,5,9,10,23]
bar(x,y)
show()

gives: Using `hist()` bins your data for you, so you would pass it your raw data, ie. it would look like this:

data = [111, 111, 111, 122, 122, 122, 122, 155, ...]

Problem

here is the data: ``` 111, 3 122, 4 155, 3 192, 5 11, 9 123, 10 120, 23 ``` now how could I able to plot a histogram using this two set of data in `matplotlib`. please help.

Original source