dimanche 19 mars 2017

How to conditionally fill a list and then conditionally create a histogram from that list

I have a function which is called by matplotlib.animation and increases in framenumber. I'm trying to create a condition where a list is filled with certain variables while the framenumber is below a certain amount and then a histogram of that list is plotted as the framenumber exceeds a certain limit.

this is my attempt so far:

def next_frame(self, framenumber):

    if framenumber < 5:

        (the part where I fill a list)

    if framenumber > 5:

        plt.figure(2)

        plt.hist(the list)

however this just runs and doesn't create the plot when the framenumber is reached. Am I missing something obvious?

Aucun commentaire:

Enregistrer un commentaire