1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
# Illustrate watchpoint mouse tracking
# 2021 Weather data for Seattle Sand Point
#
if (!strstrt(GPVAL_COMPILE_OPTIONS, "+WATCHPOINTS")) {
print "This copy of gnuplot does not support watchpoints"
exit # return to caller
}
#
# Watchpoints only work for style "with lines" and "with linespoints".
# First show the easy way: each plot contains a watched line
#
set title "Seattle (USW00094290) weather data for 2021"
set xdata time
set timefmt "%Y-%m-%d"
set datafile separator comma
set datafile columnheaders
set style data lines
set style textbox opaque
set ylabel "Temperature"
set tics nomirror
set xtics format "%b %d"
set key reverse Left
set yrange [0:*]
set ytics 10, 10, 100
set ytics format "%.3h°F"
set offset 0, 0, 5, 0
set y2range [0:3.5]
set y2tics 0, 1, 2
set my2tics 10
set y2tics format "%.2g in"
set y2label "Precipitation" offset 0, -4
plot 'weather.csv' using 3:10 title "max temp" watch mouse, \
'weather.csv' using 3:11 title "min temp" watch mouse, \
'' using 3:6 axes x1y2 with lines lc "slategrey" title "precipitation" watch mouse
pause -1 '<cr> to continue'
#
# Now we hide the actual lines being watched by setting them to "lt nodraw"
# and use the plot styles we actually want the user to see.
# In this case it is yerrorbars to show the temperature range
# and filledcurves to show periods of rainfall.
set errorbars 0.5
set pointintervalbox 0.4
plot keyentry with yerrorbars pt 6 ps 0.4 title "min/avg/max temp", \
'weather.csv' using 3:(($10+$11)/2):10:11 with yerrorbars pt 6 ps 0.4 notitle, \
'weather.csv' using 3:10 lt nodraw notitle watch mouse, \
'weather.csv' using 3:11 lt nodraw notitle watch mouse, \
'' using 3:6 axes x1y2 with filledcurve x1 fc "slategrey" title "precipitation", \
'' using 3:6 axes x1y2 lt nodraw notitle watch mouse
pause -1 '<cr> to continue'
unset datafile
reset
|