여기에 잘못 될 수있는 몇 가지가 있습니다. 데이터 파일을 보지 않고도 말할 수 없습니다. 난 내 머리 위로 떨어져 생각할 수있는 몇 가지 있습니다 : 2 열의
첫 번째 열에 50과 100 사이의 포인트가 없습니다.이 경우, 모든 데이터 포인트가 플롯 범위 밖으로 벗어납니다. 왜냐하면 set xrange [50:100]
데이터 파일에 1 열만있는 경우 ...이 경우 , gnuplot은 y 값을 보지 못합니다. (plot '../myFile.final' u 1 ...
로 변경) 지금은 당신의 데이터 파일을 볼 것을,
scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
plot 'test.dat' using (scale_x($0,50,60,0,2)):1 w lines title "scaled xrange"
당신이 사용하는 사양이 어떻게 작동하는지 모르는 경우 주, $ 앞에 숫자는 전체 열에 요소 현명한 작업 것을 예를 들면 다음과 같습니다.
plot 'foo.bar' using 1:($2+$3)
가 첫 번째 열을 더한 합계를 플롯합니다 데이터 파일의 각 행에있는 두 번째 및 세 번째 요소
이 솔루션은 데이터 파일에서 x의 최대 값을 알고 있다고 가정합니다 (이 경우 3-1 = 2 - [3 points, 0,1,2]). 데이터 포인트의 수를 모르는 경우 쉘 마술을 사용하거나 gnuplot에서 직접 얻을 수 있습니다. 첫 번째 방법은 이식성이 아니더라도 조금 쉽습니다. 나는 그 말을해야
set term push #save terminal settings
set term unknown #use unknown terminal -- doesn't actually make a plot, only collects stats
plot 'test.dat' u 0:1 #collect stats
set term pop #restore terminal settings
XMIN=GPVAL_X_MIN #should be 0, set during our first plot command
XMAX=GPVAL_X_MAX #should be number of lines-1, collected during first plot command
scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
plot 'test.dat' using (scale_x($0,50,60,XMIN,XMAX)):1 w lines title "scaled xrange"
내가 완전성에 대한 가정 :
XMAX=`wc -l datafile | awk '{print $1-1}'`
scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
plot 'test.dat' using (scale_x($0,50,60,0,XMAX)):1 w lines title "scaled xrange"
두 번째 방법은, 우리가 데이터를 통해 두 패스를하고하자의 gnuplot 최대를 선택해야합니다 : 둘 다 보여 드리죠 이것은 gnuplot 4에서 더 쉽게 할 수 있습니다.6 (나는 지금 설치되어 있지 않기 때문에이 다음 부분은 바로 문서에 대한 이해에서 비롯됩니다) :
stats 'test.dat' using 0:1 name "test_stats"
#at this point, your xmin/xmax are stored in the variables "test_stats_x_min"/max
XMIN=test_stats_x_min
XMAX=test_stats_x_max
scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
plot 'test.dat' using (scale_x($0,50,60,XMIN,XMAX)):1 w lines title "scaled xrange"
의 gnuplot 4.6은 정말 멋진 보인다. 나는 곧 그걸 가지고 놀아 볼거야.
'../ myFile.final'의 내용은 무엇입니까? – mgilson
현재 디렉토리 밖입니다! 내 콘텐츠의 방법은 사실입니다! – Mehdi