问题
I'm plotting a gnuplot diagram with float values in the y-axis and time values in the x-axis. The plotting itself works like a charm, but I can't get newlines in the time format to work.
If I use the format specifier "%d.%m.%y %H:%M" it works like a charm, and the result is: 25.05.1983 17:23. But when I add a newline character, so I have "%d.%m.%y\n%H:%M" the resulting labels are actually containing a line break but all I see is: 25.05.1983.
I also tried to increase the bmargin by several values, up to the point where the resulting plot was squished, but I just can't get the time to be shown.
Is the newline character not supported in a time format? Or does this not work at all with labels? Or maybe the png enhanced terminal doesn't support it?
UPDATE
Sample input data
20140617000045
20140617000245
20140617000445
20140617000645
I don't have any space between date and time.
回答1:
With your test data the following script works fine with 4.6.5:
set terminal pngcairo enhanced
set output 'timetest.png'
set xdata time
set timefmt '%Y%m%d%H%M%S'
set format x "%d.%m.%y\n%H:%M"
plot 'test.dat' using 1:0 with lp notitle
The output is:
Yes, the png terminal works fine as well (but its output is in general uglier).
来源:https://stackoverflow.com/questions/25763576/gnuplot-how-to-set-new-line-in-xtics-timefmt