|
From: Achim G. <Str...@ne...> - 2017-10-08 19:18:01
|
sfeam via gnuplot-beta writes:
> With one exception, gnuplot variables are global.
That is not what I was seeing (much to my surprise), although things may
have been complicated by my additional use of a call statement and
mixing with functions. So, I have a file that implements a callable
include:
--8<---------------cut here---------------start------------->8---
# call "scale.gp" linear|asinh knee
type = ((ARGC>0) ? ARG1 : "asinh")
knee = ((ARGC>1) ? ARG2 : 1e-5)
ticdef = ''
if (type eq "asinh") {
s(y) = asinh( 0.5*y/knee )
tic( s,u,n,v ) = sprintf( '"%s%i %s" %ss(%f),', s, n, u, ((s eq "±")?'':s), v );
omag = 1.
ticdef = tic( "±", "s", 0, 0 )
do for [unit in "s ms µs ns"] {
do for [mag = 0:2] {
m = 10**mag
v = omag*m
ticdef = ticdef . tic( "+", unit, m, v)
ticdef = ticdef . tic( "-", unit, m, v)
}
omag = omag / 1000.
}
ticdef = '(' . ticdef . ')'
}
if (type eq "linear") {
s(y) = y
}
set ytics @ticdef
--8<---------------cut here---------------end--------------->8---
The original version created ticdef inside the block and also set the
ytics there, but the result was never visible in the caller. This is
with gnuplot 5.0.7 from openSUSE.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
|