Back to demo index

gnuplot demo script: timedat.dem

autogenerated by webify.pl on Sat Oct 1 21:59:49 2022
gnuplot version gnuplot 5.4 patchlevel 5
set title "Fsteps plot\nwith date and time as x-values"
set style data fsteps
set xlabel "Date\nTime"
set timefmt "%d/%m/%y\t%H%M"
set yrange [ 0 : ]
set xdata time
set xrange [ "1/6/93":"1/11/93" ]
set ylabel "Concentration\nmg/l"
set format x "%d/%m\n%H:%M"
set grid
set key left
plot 'timedat.dat' using 1:3 t '', \
     'timedat.dat' using 1:3 t 'Total P' with points, \
     'timedat.dat' using 1:4 t '', \
     'timedat.dat' using 1:4 t 'PO4' with points 

Click here for minimal script to generate this plot



reset

set title "Time data on Y, millisecond precision" font ",14"
set ydata time
set timefmt "%s"
set offset 0.5,1.5,.2,.2
unset key

fulltime(col) = strftime("%d %b %Y\n%H:%M:%.3S",column(col))
parttime(col) = strftime("%H:%M:%.3S",column(col))

plot '-' using 0:1:(fulltime(1)):xticlabels(2):yticlabels(parttime(1)) \
         with labels point pt 7 left offset 1,1 font ",7"
1390852607.1	A
1390852607.2	B
1390852607.4	C
1390852607.8	D
1390852608.4	E
1390852610.001	F
e


Click here for minimal script to generate this plot



reset
set title "Date format (top) vs Time format (bottom)" font ":Bold,14"
set xrange [-7000:3000]
set link x2
set tics font ",8"
set x2tics format "%D\n%R" time
set xtics format "%tH:%tM:%tS" time

set yzeroaxis
unset ytics
set bmargin at screen .3
set tmargin at screen .6

plot x notitle


Click here for minimal script to generate this plot



print "\nRelative time output (strftime(), axis labels)"

t = -3672.5
print 't = ',t
print 'print strftime("%.2tM == %.2tS", t)' , "	", strftime("%.2tM min == %.2tS sec", t)
print 'print strftime("%tM:%.2tS", t)  ' , "	", strftime("%tM:%.2tS", t)
print 'print strftime("%tH:%tM:%.2tS", t)' , "	", strftime("%tH:%tM:%.2tS", t)

t = 3672.5
print 't = ',t
print 'print strftime("%.2tM == %.2tS", t)' , "	", strftime("%.2tM min == %.2tS sec", t)
print 'print strftime("%tM:%.2tS", t)  ' , "	", strftime("%tM:%.2tS", t)
print 'print strftime("%tH:%tM:%.2tS", t)' , "	", strftime("%tH:%tM:%.2tS", t)

print "\nRelative time input (strptime(), data files)"

print 'print strptime("%tH:%tM:%tS", "-1:01:12.50")', "\t", strptime("%tH:%tM:%tS", "-1:01:12.50")
print 'print strptime("    %tM:%tS", "-61:12.50")', "\t", strptime("    %tM:%tS", "-61:12.50")
print 'print strptime("        %tS", "-3672.50")', "\t", strptime("        %tS", "-3672.50")

print "\nTimezones time output (strftime(), axis labels)"
t = 1550496278
print 't = ',t
print 'print strftime("%d/%m/%y\t%H:%M", t)' , "	", strftime("%d/%m/%y\t%H:%M", t)
print 'print strftime("%d/%m/%y\t%H:%M%z", t)' , "	", strftime("%d/%m/%y\t%H:%M%z", t)
print 'print strftime("%d/%m/%y\t%H:%M%Z", t)' , "	", strftime("%d/%m/%y\t%H:%M%Z", t)

print "\nTimezones time input (strptime(), data files)"
print 'print strptime("%d/%m/%y\t%H:%M", "18/02/19\t13:24")', "\t", strptime("%d/%m/%y\t%H:%M", "18/02/19\t13:24")
print 'print strptime("%d/%m/%y\t%H:%M%z", "18/02/19\t12:24+00:00")', "\t", strptime("%d/%m/%y\t%H:%M%z", "18/02/19\t12:24+00:00")
print 'print strptime("%d/%m/%y\t%H:%M%z", "18/02/19\t13:24+01:00")', "\t", strptime("%d/%m/%y\t%H:%M%z", "18/02/19\t13:24+01:00")
print 'print strptime("%d/%m/%y\t%H:%M %Z", "18/02/19\t13:24 CET")', "\t", strptime("%d/%m/%y\t%H:%M %Z", "18/02/19\t13:24 CET")
print 'print strptime("%d/%m/%y\t%H:%M %Z", "18/02/19\t14:24 CEST")', "\t", strptime("%d/%m/%y\t%H:%M %Z", "18/02/19\t14:24 CEST")
reset