BRIEF
I would like to pull a single day out of my multi-week data file. So I'm using 'set xrange'. But I'm stumbling on the format: gnuplot fails with
C:\Temp\Plot>gnuplot
wst-a-rtr.gp
"
wst-a-rtr.gp" line 32: Can't plot with an empty x range!
In the config file below, uncommenting either 'set xrange' line results in the above error. Leaving them both commented out results in a beautiful chart
DETAIL
Data File:
Date Time Transmitted Dropped
2019-09-13 05:21:56 44337071 524986
2019-09-13 05:25:01 44338275 524986
2019-09-13 05:30:02 44340129 524986
2019-09-13 05:35:01 44341967 524986
2019-09-13 05:40:02 44343952 525104
[...]
Config File:
# Define variables
long_title = 'COPP Drops across Time'
data_file = 'wst-a-rtr-log.txt'
output_file = 'wst-a-rtr.png'
# File specifics
set datafile sep whitespace
set output output_file
# Chart details
set title long_title font 'sans,30'
set terminal png size 3200,1200
set grid
set xlabel "Date\nTime" font 'sans,18'
#set xrange [ "2019-09-25" : "2019-09-26" ]
#set xrange [ "2019-09-26 00:00" : "2019-09-27 06:00" ]
set ylabel 'Bytes Transmitted' textcolor '#3CB371' font 'sans,18'
set y2label 'Bytes Dropped' textcolor 'red' font 'sans,18'
set ytics border nomirror textcolor '#3CB371'
set y2tics border nomirror textcolor 'red'
set autoscale y
set autoscale y2
# Time formatting
set xdata time
set timefmt "%Y-%m-%d\t%H:%M"
set format x "%Y-%m-%d\n%H:%M"
set mxtics 24
set grid mxtics
# Do the work
plot data_file index 0 using 1:3 axis x1y1 with points pointtype 7 pointsize 1 linecolor rgb '#3CB371' title '', \
'' using 1:4 axis x1y2 with points pointtype 7 pointsize 1 linecolor rgb 'red' title ''