Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gnuplot skip capability?

808 views
Skip to first unread message

Carl Wagner

unread,
Apr 24, 2002, 5:10:17 PM4/24/02
to
Sirs...............(24 apr 02)

I am anxious to use GNUPLOT to graph many "data" records I have which are
embedded as a series inside a larger file with diverse "source" information
about the "run" which produced the "data".

Is there a command I can use in GNUPLOT to Skip the source (I call them
Header) records and just read the "data"? Yes, I can (and sometimes do)
create separate "data" files as output from my program runs but even
when I do I always have some "header information" for them. For the
most important data though, like a baby I keep it as close as possible
to its mother.


Carl Wagner


carl....@noaa.gov

Lutz Maibaum

unread,
Apr 24, 2002, 9:22:25 PM4/24/02
to
Carl Wagner <Carl....@noaa.gov> wrote:
> Is there a command I can use in GNUPLOT to Skip the source (I call them
> Header) records and just read the "data"? Yes, I can (and sometimes do)
> create separate "data" files as output from my program runs but even
> when I do I always have some "header information" for them. For the
> most important data though, like a baby I keep it as close as possible
> to its mother.

gnuplot treats all lines that start with a '#' as comments. The
easiest thing to do would be to mark all your 'header information' as
comments, and gnuplot will just skip them.

If you are working on a Unix-like platform, you can also specify an
external filter program that extracts the relevant data from your
file; something like

plot "< filter data.dat"

where 'filter' can be any external program (simply grep, or a
home-made script, or whatever). See 'help datafile special' for more
information.

Hope that helps,

Lutz

Hans-Bernhard Broeker

unread,
Apr 25, 2002, 7:23:33 AM4/25/02
to
Carl Wagner <Carl....@noaa.gov> wrote:

> Is there a command I can use in GNUPLOT to Skip the source (I call them
> Header) records and just read the "data"?

Usually, it's enough to just plot the datafile with a full using spec, i.e.

plot 'datafile' using 1:3

or whatever. gnuplot is clever enough to detect lines that don't have numbers
in whitespace-separated column one and three and ignore them. So, as long
as none of your non-data lines start with a number, you're game.

For other cases, see Lutz' answer.
--
Hans-Bernhard Broeker (bro...@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

crawford

unread,
Apr 25, 2002, 11:22:23 AM4/25/02
to
On Wednesday, April 24, 2002 Carl Wagner wrote:
>
> Sirs...............(24 apr 02)
>
> I am anxious to use GNUPLOT to graph many "data" records I
> have which are
> embedded as a series inside a larger file with diverse
> "source" information
> about the "run" which produced the "data".
>
> Is there a command I can use in GNUPLOT to Skip the source (I
> call them
> Header) records and just read the "data"? Yes, I can (and
> sometimes do)
> create separate "data" files as output from my program runs but even
> when I do I always have some "header information" for them. For the
> most important data though, like a baby I keep it as close as possible
> to its mother.
>

gnuplot gives you three ways to specify which columns are to be plotted.
All make use of the "using" option. And all treat bad (that is,
unplottable) data differently. So if "plot 'filename'" fails to exclude
your headers, maybe "plot 'filename' using 1:2" will do what you want, or
even "plot 'filename' using ($1):($2)".

Or you can start each header line with gnuplot's comment character, "#",
which will always work.

Dick Crawford, aka craw...@arete.com

0 new messages