2013-11-15 50 views
2

我使用perl腳本解析出一些天氣數據,然後用gnuplot在3行乘2列顯示中繪製這些數據。除最後一張「累計降雨量」圖外,我的所有圖表似乎都能正常工作。該圖實際上是正確繪製的,但y尺度似乎使用「Minute Rainfall」圖的設置。有人可以看看我的gnuplot代碼,看看我可能會出錯嗎?謝謝你的幫助。Gnuplot y-scale使用多點時

set terminal wxt size 1500,750 
set size ratio 0.25 
set multiplot layout 3,2 title "Weather Data at Fort Worth Alliance Airport For 10/26/2013" 
set title "Temperature/Dewpoint" 
unset key 
set xdata time 
set timefmt "%H:%M" 
set xrange ["00:00" : "24:00"] 
set xtics "00:00" , "02:00" , "24:00" 
set xlabel "Time of Day" 
set ylabel "Temperature/Dewpoint (° F)" 
set autoscale y 
set grid 
set format x "%H:%M" 
set format y "%5.1f" 
set style data lines 
plot "output2.dat" using 1:3 title 'Temperature',\ 
"output2.dat" using 1:4 title 'Dewpoint' 

set title "Barometric Pressure" 
unset key 
set xdata time 
set timefmt "%H:%M" 
set xrange ["00:00" : "24:00"] 
set xtics "00:00" , "02:00" , "24:00" 
set xlabel "Time of Day" 
set ylabel "Pressure (in Hg)" 
set autoscale y 
set grid 
set format x "%H:%M" 
set format y "%5.2f" 
set style data lines 
plot "output2.dat" using 1:2 title 'Pressure' lt -1 

set title "Peak Wind Speed" 
unset key 
set xdata time 
set timefmt "%H:%M" 
set xrange ["00:00" : "24:00"] 
set xtics "00:00" , "02:00" , "24:00" 
set xlabel "Time of Day" 
set ylabel "Wind Speed (kt)" 
set autoscale y 
set yrange [0:*] 
set grid 
set format x "%H:%M" 
set format y "%5.0f" 
set style data lines 
plot "output1.dat" using 1:3 title 'Peak Wind Speed' lt 3 

set title "Surface Visibility" 
unset key 
set xdata time 
set timefmt "%H:%M" 
set xrange ["00:00" : "24:00"] 
set xtics "00:00" , "02:00" , "24:00" 
set xlabel "Time of Day" 
set ylabel "Visibility (SM)" 
set yrange [0:10] 
set ytics "0" , "1" , "10" 
set grid 
set format x "%H:%M" 
set format y "%4.0f" 
set style data lines 
plot "output1.dat" using 1:2 title 'Surface Visibility' lt rgb "goldenrod" 

set title "One Minute Rainfall" 
unset key 
set xdata time 
set timefmt "%H:%M" 
set xrange ["00:00" : "24:00"] 
set xtics "00:00" , "02:00" , "24:00" 
set xlabel "Time of Day" 
set ylabel "Rainfall (in)" 
set autoscale y 
set yrange [0:0.25] 
set ytics "0" , "0.05" , "0.25" 
set grid 
set format x "%H:%M" 
set format y "%4.2f" 
set style data lines 
plot "output2.dat" using 1:5 title 'One Minute Rainfall' lt rgb "green" 

set title "Accumulated Rainfall" 
unset key 
set xdata time 
set timefmt "%H:%M" 
set xrange ["00:00" : "24:00"] 
set xtics "00:00" , "02:00" , "24:00" 
set xlabel "Time of Day" 
set ylabel "Rainfall (in)" 
set autoscale y 
set yrange [0:*] 
set grid 
set format x "%H:%M" 
set format y "%5.2f" 
set style data lines 
plot "output2.dat" using 1:6 title 'Accumulated Daily Rainfall' lt rgb "green" 
unset multiplot 

Output1.dat樣品

19:00 0.82 28 
19:01 0.48 28 
19:02 0.41 30 
19:03 0.41 29 
19:04 0.29 32 
19:05 0.24 31 
19:06 0.27 25 
19:07 0.32 21 
19:08 0.47 17 
19:09 0.56 15 
19:10 0.73 13 

Output2.dat樣品

19:00 29.327 60 59 0.07 0.47 
    19:01 29.331 60 59 0.10 0.57 
    19:02 29.338 59 58 0.09 0.66 
    19:03 29.345 59 58 0.10 0.76 
    19:04 29.348 59 58 0.11 0.87 
    19:05 29.350 57 57 0.12 0.99 
    19:06 29.350 57 57 0.11 1.10 
    19:07 29.349 57 56 0.09 1.19 
    19:08 29.350 57 57 0.07 1.26 
    19:09 29.355 57 56 0.08 1.34 
    19:10 29.362 57 56 0.05 1.39 

回答

0

最後情節的規模是好的,但使用從以前的劇情ytic設置。只需在最後一個劇情中使用set ytics auto即可。

順便說一句:要在最後x上顯示24:00 -tic,請使用set xtics add ("24:00" "24:00")

和許多你的設置是多餘的,請參閱下面的腳本減少:

set terminal wxt size 1500,750 
set size ratio 0.25 

unset key 
set xdata time 
set timefmt "%H:%M" 
set xrange ["00:00" : "24:00"] 
set xtics add ("24:00" "24:00") 
set format x "%H:%M" 
set xlabel "Time of Day" 
set style data lines 
set grid 

set multiplot layout 3,2 title "Weather Data at Fort Worth Alliance Airport For 10/26/2013" 

set title "Temperature/Dewpoint" 
set ylabel "Temperature/Dewpoint (° F)" 
set format y "%5.1f" 
plot "output2.dat" using 1:3 title 'Temperature',\ 
    "" using 1:4 title 'Dewpoint' 

set title "Barometric Pressure" 
set ylabel "Pressure (in Hg)" 
set format y "%5.2f" 
plot "output2.dat" using 1:2 title 'Pressure' lt -1 

set title "Peak Wind Speed" 
set ylabel "Wind Speed (kt)" 
set yrange [0:*] 
set format y "%5.0f" 
plot "output1.dat" using 1:3 title 'Peak Wind Speed' lt 3 

set title "Surface Visibility" 
set ylabel "Visibility (SM)" 
set yrange [0:10] 
set ytics 1 
set format y "%4.0f" 
plot "output1.dat" using 1:2 title 'Surface Visibility' lt rgb "goldenrod" 

set title "One Minute Rainfall" 
set ylabel "Rainfall (in)" 
set yrange [0:0.25] 
set ytics 0.05 
set format y "%4.2f" 
plot "output2.dat" using 1:5 title 'One Minute Rainfall' lt rgb "green" 

set title "Accumulated Rainfall" 
set ylabel "Rainfall (in)" 
set yrange [0:*] 
set ytics auto 
set format y "%5.2f" 
plot "output2.dat" using 1:6 title 'Accumulated Daily Rainfall' lt rgb "green" 
unset multiplot 
+0

非常感謝您的幫助!這工作完美。我也很感謝你幫助我濃縮我的劇本!多學習一點,每一天。再次感謝! – wxman