Sunday, 15 September 2013

Change visual of histogram from image using matplotlib in Python

Change visual of histogram from image using matplotlib in Python

I would like to present a histogram from an image in Python. Doing some
research, I found a way of doing it using matplotlib. So, I just do this:
im = plt.array(Image.open('Mean.png').convert('L'))
plt.figure()
plt.hist(im, facecolor='green', alpha=0.75)
plt.savefig("Histogram.png")
But I didn't like what I got:

The bars are not green, and it's kind of complicated to read the
histogram. I could not even figure out if the x axis is the number of
points and y axis the rgb color or the inverse... :S I would like to know
if somebody knows how could I turn this histogram more readable.
Thanks in advance.

No comments:

Post a Comment