Histogramme Python Matplotlib
Salut!
Je cherche à faire un histogramme tout simple (des barres) avec Python et matplotlib.
J'ai:
Code:
1 2
| y = [1, 2, 3, 4]
x = [10, 20, 30, 40] |
Je fais
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| #!/usr/bin/env python
from pylab import *
x = array([10, 20, 30, 40])
n, bins, patches = hist(x, 50, normed=1)
setp(patches, 'facecolor', 'g', 'alpha', 0.75)
xlabel('y')
ylabel('x')
title(r'Essai')
axis([1, 4, 0, 50])
grid(True)
savefig('histogram_demo',dpi=72)
close() |
(issu d'un exemple du net)
Mais je n'ai aucun résultat (j'ai bien les axes et les titres, mais pas d'histogramme). Comment faire?
Merci
Dazdh