Histogram from data which is already binned, I have bins and frequency values

I'm surprised nobody mentioned plt.step here yet for making step plots...

a= [1,2,3,4,5,6,7,8,9]
b= [5,3,4,5,3,2,1,2,3]
plt.step(a,b)

Perhaps the weight parameter would be of help in your problem.

import matplotlib.pyplot as plt

a= [1,2,3,4,5,6,7,8,9]
b= [5,3,4,5,3,2,1,2,3]
plt.hist(a,9, weights=b)
plt.show()

Or, as tcaswell said, you could just make a bar plot and change the x-axis.

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

Is a link.


Also, as an alternative (similar to Matlab), you can use bar:

import matplotlib.pyplot as plt

a= [1,2,3,4,5,6,7,8,9]
b= [5,3,4,5,3,2,1,2,3]
plt.bar(a,b)

enter image description here

Then, you can also add the title and other stuff and, finally, save the image:

plt.title("Clock cycles")
plt.grid()
plt.xlabel("Size of the matrices processed")
plt.ylabel("Clock cycles")
plt.savefig("clock_cycles.svg")