0

I've many datasets I want to look at one by one in an incoherent order. For so I'm coding a small python script that could give me a diaporama of plot: plotting one, waiting x seconds plotting a second one, etc...

For an unknown reason, I can get it to plot the first file but the other plots appear totally blank though I know that I'm feeding it non empty data. It's probably something with cleaning or flushing the window or the figure in between each plot. Here is my current code:

from pylab import plot,show,scatter,title,figure,close,ion,clf
from time import sleep
import numpy as N
from random import choice
import sys
import math

filenames = sys.argv[1:-1] #I'm passing the dataset files in argument

while True:
    my_choice = choice(filenames) #picks a random dataset out of the pool
#   print my_choice
    x = N.loadtxt(my_choice,usecols=(0,)) #reads the 2d data
    y = N.loadtxt(my_choice,usecols=(1,))
    print x,"\n\n",y
    scatter(x,y)
    title(my_choice)
    ion()
    show()
    sleep(int(sys.argv[-1])) #my last line command argument is the delay
    close()
    clf() #should flush the data and the figure
    del x,y
Learning is a mess
  • 7,479
  • 7
  • 35
  • 71

0 Answers0