mercredi 5 avril 2017

Python: IF sentence inside bar plot

It might sound strange, but I need to have IF sentence inside bar plot line. My part of code:

for col in columns[2:32:2]:
    plt.bar([p + width*n for p in pos], df[col], width, color=colors[n], hatch='x')

I have DataFrame df. I need to plot every second value of its column in grouped bars (grouped according to row) and every other second of that contains a value 0 or 1. According to that 0 or 1 value I need to have bar hatched or not. I was trying to insert IF sentence inside plt.bar(), but I was not successful.

Any ideas how to do it? If it is possible at all

Aucun commentaire:

Enregistrer un commentaire