[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variables in gnuplot commands

From: Ronald Kumon
Subject: Variables in gnuplot commands
Date: Sun, 17 Nov 1996 12:01:24 -0600 (CST)

Does anyone know why you cannot use variables in gnuplot "set" commands 
from within Octave?

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

I have been able to do the equivalent via the "eval" command:

octave> xsize=num2str(0.5)
octave> ysize=num2str(0.5)
octave> eval(["set size ",xsize,",",ysize])
octave> show size

        size is scaled by 0.5,0.5
        no attempt to control aspect ratio

but this seems a little messy.

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 has become an issue for me lately since I've started using the 
multiplot environment in gnuplot and have to adjust sizes in scripts 
for various terminal types.  BTW, I'm currently using Octave 1.1.1 (Linux ELF 
binary under kernel 2.0.0) and gnuplot 3.6 patch 315.  Any suggestions?

Ronald Kumon
Department of Physics           
University of Texas at Austin 
Austin, TX  78712-1081 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]