如何在terminal-GNUplot中指定数据

如何在terminal-GNUplot中指定数据,terminal,command,gnuplot,Terminal,Command,Gnuplot,我在.gp文件中有一个GNUplot脚本 set terminal pngcairo enhanced size 5000,500 font 'DejaVuSerifCondensed,11' rounded; set output 'acc_vrecko_predne.png' set encoding iso_8859_2 set yrange [-15:15] set xrange [0:1261] set xtics 20 set title 'dáta acceleromete

我在.gp文件中有一个GNUplot脚本

set terminal pngcairo enhanced size 5000,500 font 'DejaVuSerifCondensed,11' rounded; 
set output 'acc_vrecko_predne.png'
set encoding iso_8859_2

set yrange [-15:15]
set xrange [0:1261]
set xtics 20


set title 'dáta accelerometer - predne vrecko ' font 'DejaVuSerifCondensed-Bold,12'

set samples 7000

set style line 1  lt 1 lw 0.5 lc rgb "red"
set style line 2  lt 1 lw 0.5 lc rgb "blue"
set style line 3  lt 1 lw 1 lc rgb "green"


set datafile separator "|"


plot \
\
'data/vrecko_acc.txt' u 0:2 sm cs w l ls 1  t 'X-suradnice',\
'data/vrecko_acc.txt' u 0:3 sm cs w l ls 2  t 'Y-suradnice',\
'data/vrecko_acc.txt' u 0:4 sm cs w l ls 3  t 'Z-suradnice'

reset
是否有任何方法可以在终端中指定数据路径和文件名并从中运行脚本? 我是否应该更改.gp文件中的某些内容


THX

我上次使用它是很久以前的事了。无论如何,我想它应该可以很好地处理stdin文件,您可以通过sed或普通shell变量subst进行动态替换,如下所示:

$> x=uu; sort -u<<EOF
> a
> gg
> ${x}
> yy
> dd
> EOF
a 
dd
gg
uu
yy
$>x=uu;sort-u gg
>${x}
>yy
>dd
>EOF
A.
dd
游戏打得好
uu
yy
如果您将gnuplot脚本放在shell脚本中,并将使用“heredocument”技术

制作一个包含以下内容的文件,例如my_script.sh:

#!/bin/sh

file1="data/vrecko_acc.txt"
file2="data/vrecko_acc.txt"
file3="data/vrecko_acc.txt"
# or uncomment and use this variant to pass params as args like this:
#    sh my_script.sh data/acc1.txt data/acc2.txt data/acc3.txt 

# file1="${1}"
# file2="${2}"
# file3="${3}"

gnuplot - <<EOF
<here goes you file, do not forget to put '\'(back slash) before any $ sign>
'${file1}' u 0:2 sm cs w l ls 1  t 'X-suradnice',\
'${file2}' u 0:3 sm cs w l ls 2  t 'Y-suradnice',\
'${file3}' u 0:4 sm cs w l ls 3  t 'Z-suradnice'

reset
EOF
#/垃圾箱/垃圾箱
file1=“data/vrecko_acc.txt”
file2=“data/vrecko_acc.txt”
file3=“data/vrecko_acc.txt”
#或取消注释并使用此变量将参数作为参数传递,如下所示:
#sh my_script.sh data/acc1.txt data/acc2.txt data/acc3.txt
#file1=“${1}”
#file2=“${2}”
#file3=“${3}”

gnuplot-Hmmm我是linux新手,我不懂:D你能解释一下吗?不需要再问类似的问题了。尽管如此,你的问题还是有答案的。