0

I have an array of values and I want to plot a histogram where each index of the array is a bin and the height of the bin is determine by the value in that index. How can I do this using python and matplotlib?

Example: x = [25, 100, 52,12] and my histogram has 4 bins, and each has a height corresponding to the value per index.

Mnemosyne
  • 1,162
  • 4
  • 13
  • 45
  • What you're describing sounds more like a [bar chart](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html) than a histogram, since you're using the numeric values explicitly rather than the counts passed in to the function. What have you tried so far? – G. Anderson Feb 05 '19 at 23:51
  • 1
    You need a bar chart from your description. [Here](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html) is how to do that. – Sheldore Feb 06 '19 at 00:00

0 Answers0