[matplotlib] can't get any output

Hi,

I want to plot data from two different datafiles. To do so I use
numpy.loadtxt two times in the script (see below).
The problem is, that I don't get any output: no resulting plot, no
errormessages or something in the terminal.
Even if I comment-out one loadtxt-row nothing happens. Even if I try
to plot something simple without using the loaded datafiles, nothing
happens. Other files with simple plots without using a datafile work
fine.
Can't find my mistake.

Manuel

#!/usr/bin/env python
from pylab import *
import numpy as np

datafile1 = '/path/to/datafile1.dat'
datafile2 = '/path/to/datafile2.dat'

TIME_F, STIRRER, O2, CO2 = np.loadtxt(datafile1, dtype='float',
comments='#', delimiter='\t', usecols=(0,1,2,3), unpack=True)
TIME_H, OD, FLUOR, BTM, GLY = np.loadtxt(datafile2, dtype='float',
comments='#', delimiter='\t', usecols=(0,1,2,3,4), unpack=True)

plot(TIME_F, O2)

Hi Manuel,

adding a "show()" to your script should resolve the problem. You don't need
this using ipython in "-pylab" mode, matplotlibs interactive mode or if you
save your figure to some file (savefig), but in your case you need to call
the main loop.

Kind regards
Matthias

from the docu: Use show()
The user interface backends need to start the GUI mainloop, and this is what
show() does. It tells matplotlib to raise all of the figure windows and start
the mainloop. Because the mainloop is blocking, you should only call this
once per script, at the end. If you are using matplotlib to generate images
only and do not want a user interface window, you do not need to call show.

ยทยทยท

On Friday 11 December 2009 10:39:40 Manuel Wittchen wrote:

Hi,

I want to plot data from two different datafiles. To do so I use
numpy.loadtxt two times in the script (see below).
The problem is, that I don't get any output: no resulting plot, no
errormessages or something in the terminal.
Even if I comment-out one loadtxt-row nothing happens. Even if I try
to plot something simple without using the loaded datafiles, nothing
happens. Other files with simple plots without using a datafile work
fine.
Can't find my mistake.

Manuel

#!/usr/bin/env python
from pylab import *
import numpy as np

datafile1 = '/path/to/datafile1.dat'
datafile2 = '/path/to/datafile2.dat'

TIME_F, STIRRER, O2, CO2 = np.loadtxt(datafile1, dtype='float',
comments='#', delimiter='\t', usecols=(0,1,2,3), unpack=True)
TIME_H, OD, FLUOR, BTM, GLY = np.loadtxt(datafile2, dtype='float',
comments='#', delimiter='\t', usecols=(0,1,2,3,4), unpack=True)

plot(TIME_F, O2)