plotting data against a time axis

Alexander Schmolck a.schmolck at gmx.net
Tue Nov 18 12:29:17 EST 2003


Gerrit Holl <gerrit at nl.linux.org> writes:

> Alexander Schmolck wrote:
> > Gerrit Holl <gerrit at nl.linux.org> writes:
> > > zero experience, I don't know where to start. What makes it difficult
> > > is that I have a time axis instead of a simple integer x-axis. Gnuplot
> > > doesn't seem to be able to do this, or does it?
> > 
> > > gnuplot
> > 
> >         G N U P L O T
> >         Version 3.8j patchlevel 0
> >         last modified Wed Nov 27 20:49:08 GMT 2002
> > 
> > Terminal type set to 'x11'
> > gnuplot> help time
> > Ambiguous request 'time'; possible matches:
> >         time/date
> >         time_specifiers
> >         timefmt
> >         timestamp
> > 
> > Not what you want?
> 
> Hm, maybe it is, actually :). It seems my estimate was incorrect; to be
> fair, I assumed Gnuplot was used solely for plotting functions, not data.
> Maybe it is wise to invest some time in learning Gnuplot, I may be happy
> with it later as well.

I think it is well worthwhile.

I used to regard gnuplot as a waste of time (because of its poor output
quality and a number of bizzarre warts), and because I have matlab available
for plotting (also from within python), which has very comprehensive
functionality.

However I came to appreciate that gnuplot is actually quite useful for quick
and dirty plots, in particular from somewhat messy input files, because
gnuplot helpfully just ignores stuff it can't regard as datapoints. Also its
text based interface, although not perfect, is also far more effective than
most GUI crap, once you got a slight hang of it and saving the plot results in
a file of gnuplot commands which is easy to modify and/or to reuse. Finally
gnuplot has the advantage of being quite ubiquitous and will presumably stay
around for another couple of years.

As a quick example, this will generate a 3D point plot from a text file (that
amongst other things) contains point coordinates in 3 columns (2,3,4).

gnuplot> splot 'locs.xyz' using 2:3:4 with points

Than's to unique prefixes, you'd actually just have to type something like:

gnuplot> sp 'locs.xyz' us 2:3:4 w p

A final word of advice: I'd strongly recommend you track down version 3.8j (or
latter, if already available) -- it has extremely useful enhancements such as
zooming with mouse and decent 3d plots.

'as




More information about the Python-list mailing list