2014-12-03 3 views
-1

.gp 파일에 GNUplot 스크립트가 있습니다.터미널에서 데이터를 지정하는 방법 - 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

+0

필요 없음을 다시 비슷한 질문을 할 수 있습니다. 그래도 질문은 [명령 줄 인수를 gnuplot에 전달하는 방법]에 대한 질문입니다 (http://stackoverflow.com/q/12328603/2604213). – Christoph

답변

0

이전에 내가 사용한 적이있었습니다. 어떤 방법, 나는 표준 입력 파일과 함께 잘 작동 할 수 있어야한다 생각하고,이 같은 나오지도 또는 일반 쉘 변수가 치환에 의해 즉시 대체 할 수

$> x=uu; sort -u<<EOF 
> a 
> gg 
> ${x} 
> yy 
> dd 
> EOF 
a 
dd 
gg 
uu 
yy 

당신은 당신의의 gnuplot 스크립트를 넣어 경우 쉘 스크립트를 사용하고 'Here Document'기술을 사용합니다.

은 다음과 같은 내용으로 예를 들어 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 
+0

흠 나는 리눅스에 익숙하지 않다. 나는 이해하지 못한다 : D 조금 설명 할 수 있니? – Mirko

+0

업데이트를 참조하십시오. –

관련 문제