Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #4229

Trouble setting xrange when x is a time

Newsgroups comp.graphics.apps.gnuplot
Date 2019-09-27 06:23 -0700
Message-ID <a92ba117-f516-4b7e-93e5-8054c032bc3f@googlegroups.com> (permalink)
Subject Trouble setting xrange when x is a time
From stuart.kendrick.sea@gmail.com

Show all headers | View raw


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 '' 

Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar


Thread

Trouble setting xrange when x is a time stuart.kendrick.sea@gmail.com - 2019-09-27 06:23 -0700
  Re: Trouble setting xrange when x is a time Karl Ratzsch <mail.kfr@gmx.net> - 2019-09-27 23:44 +0200
    Re: Trouble setting xrange when x is a time Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2019-09-28 15:23 +0200
    Re: Trouble setting xrange when x is a time stuart.kendrick.sea@gmail.com - 2019-09-30 04:19 -0700

csiph-web