2013-10-09 4 views
2

필자의 gnuplot을 가독성을 위해 누적 플롯으로 나누려고합니다. 나는 마력과 토크 데이터가 같은 플롯에 있고 다른 데이터가이 아래의 스택 된 플롯에 별도로 표시되도록하고 싶습니다. 모두 동일한 X 축에 의해 정렬됩니다. 정렬의이 같은 :gnuplot complex stacked plots

http://abloriginalparts.com/pb/wp_2f5b1e2e/images/img1226948967fe0ad9dc.JPG

나는 multiplot의 변화를 시도했지만 제대로 표시 할 일을 얻을 수없는 것. 여기에 nonmultiplot 버전입니다 :

여기

http://i1347.photobucket.com/albums/p715/balaguru42/dyno_zpsc0213c60.png

set term png 
set y2range [-5:40] 
set y2tics 
set ytics nomirror 
set xlabel 'RPM' 
set ylabel 'Torque/Power' 
set y2label 'AFR/Timing/Boost/MAF' 
set key bottom 
InRange(x)=((x>0) ? x : 1/0) 
ConvertMap(x)=(x-1) * 14.5 
ConvertMapDelta(x)=x * 14.5 
ConvertMaf(x)=x * 3 
ConvertMafDelta(x)=x * 3 
set output "output/dyno.png" 
plot \ 
    "output/dyno.dat" using 1:(InRange($2)):3 \ 
     with yerrorbars title 'Torque (ft-lbs)', \ 
    "output/dyno.dat" using 1:(InRange($4)):5 \ 
     with yerrorbars title 'Power (hp)', \ 
    "output/dyno.dat" using 1:(InRange($6)):7 \ 
     with yerrorbars axes x1y2 title 'AFR', \ 
    "output/dyno.dat" using 1:(InRange($8)):9 \ 
     with yerrorbars axes x1y2 title 'Ignition (deg)', \ 
    "output/dyno.dat" using 1:(InRange($10)):11 \ 
     with yerrorbars axes x1y2 title 'Intake (deg)', \ 
    "output/dyno.dat" using 1:(InRange(ConvertMap($12))):(ConvertMapDelta($13)) \ 
     with yerrorbars axes x1y2 title 'Boost (psi)', \ 
    "output/dyno.dat" using 1:(InRange(ConvertMaf($16))):(ConvertMafDelta($17)) \ 
     with yerrorbars axes x1y2 title 'MAF (V x 3)' 

답변

1

당신이 첫 번째 링크로 참조 플롯의 종류를 얻을 수있는 방법이다.

같은 플롯에 horsepowers과 토크를 가지고 있지만 다른 축으로 사용하려면

set ytics nomirror 
set y2tics 
set ylabel 'horse power (hp)' 
set y2label 'torque (ft-lbs)' 
set style data yerrorbars 
plot 'output/dyno.dat' using 1:4:5 title 'Power (hp)',\ 
    '' using 1:2:3 title 'Torque (ft-lbs)' 

아래의 다른 데이터 플롯, 당신은 multiplot 모드를 필요 스택. 위 그래프는 y2시킴으로써 행한다에 틱 및 라벨을 가지고 있지만, 대신 자동으로 계산 명시 적으로 마진 사용해야합니다, 왼쪽과 오른쪽에 동일한 마진을 위해 :

set ytics nomirror 
set y2tics 
set ylabel 'horse power (hp)' 
set y2label 'torque (ft-lbs)' 
set format x '' 
set xrange[1000:7000] 

set style data yerrorbars 

set multiplot 

set lmargin 8 
set rmargin 8 
set tmargin 1 
set bmargin at screen 0.4 

plot 'output/dyno.dat' using 1:4:5 title 'Power (hp)',\ 
    '' using 1:2:3 title 'Torque (ft-lbs)' 

unset y2tics 
unset y2label 
set format x 
set xlabel 'RPM' 
set ylabel 'AFR/Timing/Boost/MAF' 

set tmargin at screen 0.38 
set bmargin 4 
plot 'output/dyno.dat' using 1:6:7 title 'AFR' 

unset multiplot 

나는 모든 스케일링을 왼쪽 구조체를보다 명확하게 만드는 테스트 함수를 제공합니다. 상단 및 하단의 플롯의 축 수가 y 축에 다른 숫자 인 경우 offset으로 ylabel 중 하나를 다른 것과 정렬하도록 조정해야 할 수 있습니다 (예 : set ylabel 'ylabel' offset -1. offset 숫자는 문자 너비 측면에서 제공됩니다.

왼쪽 및 오른쪽 여백을 문자 너비 측면에서 설정 했으므로 값을 조정해야 할 수도 있습니다. 상단 그림의 하단 여백과 하단 그림의 상단 여백에 대해 분수 화면 좌표를 사용했습니다.

BTW : 실제로 비트 맵 터미널을 사용해야하는 경우 png 대신 pngcairo을 사용하십시오. 바람직하게는 예를 들어 pdfcairo 또는 이와 유사한 벡터 기반 출력 형식.