i using gnuplot_i library (version 2.11) in c -code generates png -pictures. time/date column not format correctly.
source:
gnuplot_ctrl * h0 ; h0 = gnuplot_init() ; gnuplot_set_xlabel(h0, "header") ; gnuplot_cmd(h0, "set terminal png size 800,480") ; gnuplot_cmd(h0, "set output 'picture.png'") ; gnuplot_cmd(h0, "set xdata time") ; gnuplot_cmd(h0, "set timefmt '%y-%m-%d-%h:%m'") ; gnuplot_cmd(h0, "set format x '%h:%m' ") ; gnuplot_cmd(h0, "set grid") ; gnuplot_cmd(h0, "plot \"datafile.tsv\" u 1:2 w l t \"title\" "); gnuplot_close(h0) ;
datafile.tsv contains:
2017-09-08-18:03 12.69 2017-09-08-18:04 12.69 2017-09-08-18:05 12.69 2017-09-08-18:06 12.69
...
unfortunately command gnuplot_cmd(h0, "show timefmt");
produces error:
warning: empty x range
[1.48323e+09:1.48323e+09],
adjusting [1.4684e+09:1.49806e+09] default format reading time data "%y-no such file or directory-0- %h:%m"
why %m formatted "no such file or directory" , %d "0" ?
i've read gnuplot_i manual, , command gnuplot_cmd
has parameter cmd
should formatted in printf
function. time format interpreted format string because of '%' characters. should use instead like
gnuplot_cmd(h0, "set timefmt \"%%y-%%m-%%d-%%h:%%m\""); gnuplot_cmd(h0, "set format x \"%%h:%%m\"") ;
Comments
Post a Comment