user1938995
user1938995

Reputation: 11

gnuplot: How can I add vertical grid line only at midnight every day when using a time xscale?

How can I add vertical grid line only at midnight every day when using a time xscale in gnuplot? I want to be able to produce multiple plots with different time spans from 24-hours to 2-months. I want to put a vertical grid line at midnight every day on the graph so I can easily distinguish individual days on the graph. This is what my gnuplot script looks like now:

set terminal png size 900, 300
set output "images/temps.png"
set xdata time
set timefmt "%m/%d/%y %H:%M"
set datafile separator ","
set ylabel "Temperature \260F"
set xlabel "Time"
set grid ytics
set y2tics mirror
set y2label "Temperature \260F"
set grid xtics lc rgb "#888888" lw 1 lt 0
plot [:][:] 'data.csv' using 1:2 title "" with lines

With this script, I get vertical grids added at automatic intervals. Those intervals are meaningful intervals, but I want to be able to force the spacing.

Upvotes: 0

Views: 855

Answers (1)

user1938995
user1938995

Reputation: 11

I found my answer:

set xtics 86400

This is in seconds. 86400 seconds in 24 hours.

Upvotes: 1

Related Questions