Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2073 > unrolled thread

how to access external variables ?

Started bygvdmoort <gvdmoort@skynet.be>
First post2011-01-30 03:45 -0800
Last post2011-01-30 13:08 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  how to access external variables ? gvdmoort <gvdmoort@skynet.be> - 2011-01-30 03:45 -0800
    Re: how to access external variables ? Ingo Thies <ingo.thies@gmx.de> - 2011-01-30 13:08 +0100

#2073 — how to access external variables ?

Fromgvdmoort <gvdmoort@skynet.be>
Date2011-01-30 03:45 -0800
Subjecthow to access external variables ?
Message-ID<276f4205-ebd2-4178-89ea-a5e53191dfcb@m16g2000prc.googlegroups.com>
Hello,

I'd like to plot at regular intervalls a file with gnuplot
instructions (say "foo.dem"), eventually with cron.

But the title of the plot should be dependant of external variables,
so it can't be specified in the .dem file. It could be for instance
the time at this moment.

And it could be interessant to save the plots in files with differents
names, dependant of such variables.

Is it possible to specify a string or any variable according to an
environment variable, or to pass it through an option ?

Thanks in advance,

Gauthier

[toc] | [next] | [standalone]


#2083

FromIngo Thies <ingo.thies@gmx.de>
Date2011-01-30 13:08 +0100
Message-ID<8ql2lnF6unU1@mid.individual.net>
In reply to#2073
Am 2011-01-30 12:45, schrieb gvdmoort:

> But the title of the plot should be dependant of external variables,
> so it can't be specified in the .dem file. It could be for instance
> the time at this moment.

Depending on what you particularly want, you could create an auxiliary 
file "aux.gp" containing statements like

titlestring="yourtitle"

(and also define, of course, numerical variables uses in the plot, 
accordingly) and load it into gnuplot by

load "aux.gp"

You can also  convert numbers into strings via the sprintf function (it 
actually uses a C printf statement to create a string; please see the 
gnuplot help or gnuplot.pdf for more information) and concatenate 
strings with

string3=string1.string2

or

string3="something"."somethingelse".sprintf(...)

etc.

> And it could be interessant to save the plots in files with differents
> names, dependant of such variables.

You can define the output file name (which is set by set output <name>) 
using the strings created like shown above. Maybe there is another 
method I am not aware of, but passing variables via a helper file gives 
you a high degree of freedom.

HTH,

Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web