> Modules non standards > Matplotlib > Lineplot
Lineplot
Pour juste tracer une courbe : pyplot.plot([1, 2, 3, 4], [4, 8, 5, 4], linestyle = ':', marker = 'o', color = 'red', markersize = 10)
Pour tracer un ensemble de courbes à partir d'une matrice (ici, en fait un dataframe pandas) :
- pour tracer une courbe par colonne : pyplot.plot(df)
- pour tracer une courbe par ligne : pyplot.plot(df.T) (on transpose le dataframe).
Exemple :
df = pandas.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}, index = ['a', 'b', 'c'])
plts = pyplot.plot(df, marker = 'o')
pyplot.legend(plts, df.columns)
Copyright python-simple.com
programmer en python, tutoriel python, graphes en python, Aymeric Duclert