[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Variables in gnuplot commands
From: |
John W. Eaton |
Subject: |
Variables in gnuplot commands |
Date: |
Tue, 19 Nov 1996 18:46:11 -0600 |
On 17-Nov-1996, Ronald Kumon <address@hidden> wrote:
: Does anyone know why you cannot use variables in gnuplot "set" commands
: from within Octave?
Yes.
: For example, in gnuplot you can execute the commands:
:
: gnuplot> xsize=0.5
: gnuplot> ysize=0.5
: gnuplot> set size xsize,ysize
: gnuplot> show size
:
: size is scaled by 0.5,0.5
: no attempt to control aspect ratio
:
: However, the corresponding commands in octave give:
:
: octave> xsize=0.5
: octave> ysize=0.5
: octave> set size xsize,ysize
: octave> line 0: undefined variable: xsize
This happens because Octave only parses the set command by noting that
it is a set command and then passing all the remaining text (up until
the next newline or semicolon) directly to gnuplot. It never notices
that there might be variables that should be expanded.
: Interestingly enough, variable substitution does occur automatically
: in the gplot command since
:
: octave> ltnum=3
: octave> gplot "data" using 1:3 with lines ltnum
:
: will successfully plot columns 1 and 3 of "data" with a line of linetype 3.
This works because Octave does parse the complete gplot command, and
performs the appropriate variable substitutions. Doing the same for
the set command would be a lot of work because gnuplot's set command
has a lot of different options. I'm not sure that it is worth the
effort.
Thanks,
jwe