Reputation: 33
I am parsing out some weather data using a perl script and then plotting this data with gnuplot in a 3 row by 2 column display. All of my graphs seem to be working properly except for the last graph "Accumulated Rainfall". The graph is actually drawn correctly but the y-scale seems to be using the settings for the "Minute Rainfall" graph. Can someone take a look at my gnuplot code and see where I may be going wrong? Thanks for any help.
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
Upvotes: 3
Views: 5808
Reputation: 48390
The scale of the last plot is fine, but the ytic
settings from the previous plot are used. Just use set ytics auto
in the last plot and you're fine.
BTW: To have a 24:00
displayed on the last x
-tic, use set xtics add ("24:00" "24:00")
.
And many of your setting are redundant, see the reduced script below:
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
Upvotes: 1