Page 1 of 1

Erstellen von Balkendiagrammen in Python

Posted: 02 Apr 2025, 04:15
by Anonymous
Ich habe ein paar Probleme mit dem Balkendiagramm, das ich in Python erstellen möchte. Mein Code für das Diagramm sieht so aus: < /p>

import matplotlib
matplotlib.use('Agg')
from pylab import *
import calendar

def webshow(img):
savefig(img,dpi=500)
print 'Content-Type: text/html\n'
print ''

genres = []
n = 0
for c in sorted_list:
genres.append(sorted_list[n][0])
n += 1

grosses = []
a = 0
for c in sorted_list:
grosses.append(sorted_list[a][1])
a += 1

clf()
bar(arange(len(grosses)),grosses)
xticks( arange(len(genres)),genres, rotation=80)
webshow("barchart.png")
< /code>

Mein Diagramm sieht folgendermaßen aus: < /p>