gpt4 book ai didi

使用多图时的 Gnuplot y 尺度

转载 作者:行者123 更新时间:2023-12-04 18:08:43 26 4
gpt4 key购买 nike

我正在使用 perl 脚本解析一些天气数据,然后使用 gnuplot 在 3 行 2 列显示中绘制这些数据。除了最后一张图“累积降雨量”之外,我的所有图表似乎都可以正常工作。该图实际上绘制正确,但 y 尺度似乎使用了“分钟降雨量”图的设置。有人可以看看我的 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 样本

 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

最佳答案

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

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

关于使用多图时的 Gnuplot y 尺度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20007871/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com