我尝试用一年左右的日出和日落时间绘制图表。这是我的绘图脚本:
set terminal png size 1000,500
set output "dose.png"
set xlabel "2018"
set label 1 'secs after midnight' at graph -0.08, graph 0.3 rotate
set xdata time
set timefmt "%m-%d"
set xtics "1",2592000,"365" out
set format x "%m-%d"
set ytics "0",3600,"86400" out
set title "sunrise and sunset at Oulu"
set key off
datafile="./f.data"
set yrange ["0":"86399"]
plot datafile using 1:2 w filledcurve x1 lc rgb "#BFD0FB", \
'' using 1:3 w filledcurve x2 lc rgb "#BFD0FB", \
'' using 1:4 w filledcurve x1 lc rgb "#7FA2F7", \
'' using 1:5 w filledcurve x2 lc rgb "#7FA2F7", \
'' using 1:6 w filledcurve x1 lc rgb "#3F74F3", \
'' using 1:7 w filledcurve x2 lc rgb "#3F74F3", \
'' using 1:8 w filledcurve x1 lc rgb "#0046F0", \
'' using 1:9 w filledcurve x2 lc rgb "#0046F0", \
'' using 1:10 w filledcurve x1 lc rgb "#002EA0", \
'' using 1:11 w filledcurve x2 lc rgb "#002EA0", \
'' using 1:12 w filledcurve x1 lc rgb "#001750", \
'' using 1:13 w filledcurve x2 lc rgb "#001750", \
'' using 1:14 w filledcurve x1 lc rgb "black", \
'' using 1:15 w filledcurve x2 lc rgb "black"
这是f.data
的一行:
4-23 15720 72660 15540 72780 15300 73020 15120 73200 11280 77100 3480 84840 0 86400
但是,我想将yticsk改为几小时,但我无法做到。我想看10而不是36000和23而不是82800.我怎么能这样做?
如果需要,我可以更改数据文件的格式。
答案 0 :(得分:0)
可能有更好的方法,但这应该有效:
set ytics ("" 0)
do for [y = 0:23] {
set ytics add (sprintf("%d",y) (y*3600))
}
第一个set
是删除默认值,然后我们遍历值0到23并执行set ytics add ("..." ...)
添加一个新的显式标签,该标签由字符串和y值组成它应该被放置。