Python-Plot einfaches Histogramm gegeben Binned-Daten

Ich habe Zähldaten (davon 100), die jeweils einem Fach entsprechen (0 bis 99). Ich muss diese Daten als Histogramm darstellen. Das Histogramm zählt diese Daten jedoch und stellt sie nicht richtig dar, da meine Daten bereits zusammengefasst sind.

import random
import matplotlib.pyplot as plt
x = random.sample(range(1000), 100)
xbins = [0, len(x)]
#plt.hist(x, bins=xbins, color = 'blue') 
#Does not make the histogram correct. It counts the occurances of the individual counts. 

plt.plot(x)
#plot works but I need this in histogram format
plt.show()

Antworten auf die Frage(6)

Ihre Antwort auf die Frage