|
From: <she...@be...> - 2010-05-19 19:03:23
|
Hi Gnuplotters I have a gnuplot script to which I would like to pass an numerical argument. How might I do this? Thank you |
|
From: tmacchant <tma...@ya...> - 2015-06-11 22:18:37
|
The call command is intended to call other script from gnuplot script file. Input file is a gnuplot script file that one call from gnuplot script file. You wrote a input file as shell script. It is wrong usage for call command. Tatsuro -- View this message in context: http://gnuplot.10905.n7.nabble.com/passing-an-argument-to-gnuplot-script-tp94p19524.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: tmacchant <tma...@ya...> - 2015-06-12 07:26:46
|
> Hi i have the same problem but man page says i should write call "<input-file>" <parameter-0> > i don't understand what input file ? > I was going to type -----> gnuplot script.sh 2 so how do i use call ? You want use argument when gnuplot in batch mode. ******************************************* >gnuplot --help Usage: gnuplot [OPTION] ... [FILE] -V, --version -h, --help -p --persist -d --default-settings -c scriptfile ARG1 ARG2 ... -e "command1; command2; ..." gnuplot 5.1 patchlevel 0 Report bugs to gnu...@li... ******************************************* Perhaps what you want is -c scriptfile ARG1 ARG2 ... Tatsuro -- View this message in context: http://gnuplot.10905.n7.nabble.com/passing-an-argument-to-gnuplot-script-tp94p19526.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: tmacchant <tma...@ya...> - 2015-06-12 20:10:57
|
>#!/bin/bash >set xlabel "start" >set ylabel "Delay" >set autoscale You are confusing gnuplot script and bash shell command. #!/bin/bash declare that this file is bash shell script. You cannot write gnuplot command in bash shell script. Tatsuro -- View this message in context: http://gnuplot.10905.n7.nabble.com/passing-an-argument-to-gnuplot-script-tp94p19528.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Tatsuro M. <tma...@ya...> - 2015-06-14 06:35:49
|
----- Original Message ----- > From: tmacchant > To: gnuplot-info > Cc: > Date: 2015/6/13, Sat 04:49 > Subject: Re: [Gnuplot-info] passing an argument to gnuplot script > >> #!/bin/bash >> set xlabel "start" >> set ylabel "Delay" >> set autoscale > > You are confusing gnuplot script and bash shell command. > > #!/bin/bash declare that this file is bash shell script. You cannot write > gnuplot command in bash shell script. > > Tatsuro > The below examples are not strictly passing the arguments but practically do the similar thing. #test.gp plot a*x+b #end of test.gp $ echo "a=2;b=3;load 'test.gp'" | gnuplotcvs --persist or $ gnuplot -e "a=2;b=3;load 'test.gp'" --persist The idea is taken from the octave-ML. http://octave.1599824.n4.nabble.com/Pass-argument-to-script-file-td4670853.html HTH Tatsuro |
|
From: Tatsuro M. <tma...@ya...> - 2015-06-14 07:34:26
|
----- Original Message ----- > From: Tatsuro MATSUOKA > To: tmacchant3 gnuplot-info > Cc: > Date: 2015/6/14, Sun 15:35 > Subject: Re: [Gnuplot-info] passing an argument to gnuplot script > > ----- Original Message ----- > >> From: tmacchant >> To: gnuplot-info >> Cc: >> Date: 2015/6/13, Sat 04:49 >> Subject: Re: [Gnuplot-info] passing an argument to gnuplot script >> >>> #!/bin/bash >>> set xlabel "start" >>> set ylabel "Delay" >>> set autoscale >> >> You are confusing gnuplot script and bash shell command. >> >> #!/bin/bash declare that this file is bash shell script. You cannot write >> gnuplot command in bash shell script. >> >> Tatsuro >> > > The below examples are not strictly passing the arguments but practically do the > similar thing. > > #test.gp > plot a*x+b > #end of test.gp > > $ echo "a=2;b=3;load 'test.gp'" | gnuplotcvs --persist > or > $ gnuplot -e "a=2;b=3;load 'test.gp'" --persist > > The idea is taken from the octave-ML. > > http://octave.1599824.n4.nabble.com/Pass-argument-to-script-file-td4670853.html > > HTH > > Tatsuro Using call command on gnuplot version 5 or later #calltest.gp plot ARG1*x+ARG2 $ gnuplot -e "call 'calltest.gp' 2 3" --persist HTH Tatsuro |
|
From: tmacchant <tma...@ya...> - 2015-06-15 23:13:28
|
> okay if i want to pass a parameter ,i have the bash script and i want to call my gnuplot file and pass > > this parameter (which is a number)to it . now in the bash script i used > this command gnuplot /home/yas/file.gnuplot $1 > and in the gnuplot file i need to be able to take this $1 ..how to do > that? > i tried arg but it did not work! I did not say the below works gnuplot /home/yas/file.gnuplot $1 I have wrote some working examples. Did not you look those? As far as I know, there are two ways to pass the parameter to the script. The below examples were already written in separately, but I summarize in one for the convenience. **************************************************** 1. Scripts are prepared to use parameters and initial values of them are determined outside of script. #test.gp set term pngcairo set out 'paratest.png plot a*x+b set out #end of test.gp echo "a=2;b=3;load 'test.gp'" | gnuplotcvs or gnuplot -e "a=2;b=3;load 'test.gp'" 2. Prepare scripts using argument variable ($0, $1,... (ver. <= 4) or ARG1, ARG2, (ver.5)) and argument passed by command line **************************************************************************** Note that command line options are changed at ver. 5. Version 4 $ gnuplot --help Usage: gnuplot [OPTION]... [FILE] for X11 options see 'help X11->command-line-options' -V, --version -h, --help -p --persist -d --default-settings -e "command1; command2; ..." Version 5 $ gnuplot --help Usage: gnuplot [OPTION] ... [FILE] for X11 options see 'help X11->command-line-options' -V, --version -h, --help -p --persist -d --default-settings -c scriptfile ARG1 ARG2 ... -e "command1; command2; ..." The option to use call mechanism is added on ver. 5 -c scriptfile ARG1 ARG2 ... **************************************************************************** I show a example for ver.5 #calltest.gp a=ARG1; b=ARG2 set term pngcairo set out 'paratest.png plot a*x+b set out #end of calltest.gp gnuplotcvs -e "call 'calltest.gp' 2 3" # works on all version or gnuplotcvs -c calltest.gp 2 3 # works only on ver. 5 or later For ver.4 or before, ARG1 and ARG2 should be replaced by $0 and $1. Note for call script for ver.4 or before, NOTE: there is a clash in syntax with the datafile `using` callback operator. Use `$$n` or `column(n)` to access column n from a datafile inside a `call`ed datafile plot. Tatsuro -- View this message in context: http://gnuplot.10905.n7.nabble.com/passing-an-argument-to-gnuplot-script-tp94p19532.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |