Comment tracer une très simple graphique à barres (Python, Matplotlib) en utilisant l'entrée *.fichier txt?

J'utilise Python 2.7 et matplotlib. J'ai un *.txt fichier de données :

0 14-11-2003
1 15-03-1999
12 04-12-2012
33 09-05-2007
44 16-08-1998
55 25-07-2001
76 31-12-2011
87 25-06-1993
118 16-02-1995
119 10-02-1981
145 03-05-2014

première colonne de mon fichier (chiffres) doit être sur l'axe Y dans mon graphique à barres, et la deuxième colonne de mon fichier (dates) doit être sur l'axe OX dans mon histogramme. Je ne sais pas comment lire le fichier:

OX = []
OY = []

try :
    with open('data.txt', 'r') as openedFile :
        for line in openedFile :
            tab = line.split()
            OY.append(int(tab[0]))
            OX.append(str(tab[1]))
except IOError :
    print("IOError!")

J'ai lu un matplotlib docs mais cela ne m'aide pas. Je tiens également à ajouter des dates, j'ai lu à mon graphique à barres, pour la faire ressembler à

Comment tracer une très simple graphique à barres (Python, Matplotlib) en utilisant l'entrée *.fichier txt?

Quelqu'un pourrait-il m'aider?

InformationsquelleAutor mazix | 2012-07-23