mercredi 26 mai 2021

Matplotlib unaligned values and names of graphs

Good day! I am making a django app that would plot graphs from a text document. In the text document data is aligned this way:

name 10
name_2 20
name_3 100
typeofthegrah

I just split everything by spaces and put in 2 lists (names and values), then I just do plt.bar(names, values) and get something like this graphs

name1 189
name2 149 
name3 23
name4 82
name5 245
name6 90
column

I tried sorting them with zip but it didn't work. It works perfectly if I plot it as a pie chart but linear and bar graphs are broken.




Aucun commentaire:

Enregistrer un commentaire