使用多时隙时的Gnuplot y-scale

时间:2013-11-15 18:15:29

标签: gnuplot

我正在使用perl脚本解析一些天气数据,然后使用gnuplot在3行2列显示中绘制此数据。我的所有图表似乎都正常工作,除了最后一张图表"累积降雨"。该图实际上是正确绘制的,但y尺度似乎是使用" Minute Rainfall"图形。有人可以看看我的gnuplot代码,看看我可能会出错吗?谢谢你的帮助。

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 Sample

 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 Sample

  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

1 个答案:

答案 0 :(得分:1)

最后一个绘图的比例很好,但使用了上一个图中的ytic设置。只需在最后一个情节中使用set ytics auto即可。

顺便说一句:要在最后24:00 - tic上显示x,请使用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