1994-01-01 00:00 34.750
1994-01-02 00:00 53.000
1994-01-03 00:00 31.625
...
2006-12-29 00:00 9.471
2006-12-30 00:00 17.443
2006-12-31 00:00 32.471
(The series could however also start in 2005 or the mid-80's)
I want PNGs with major xtics for each year (on 1 Jan) and 11 minor
xtics for the months in between. I understand that I can define a
start point according to timefmt and an increment in seconds, but as
the number of seconds per month and year varies... what can I do?
Furthermore, when defining: set xtics '1980-01-01 00:00',31536000,
then I only get xtics from 2000 onwards. Is this a bug which has
something to do with gnuplot working internally with seconds since 1
Jan 2000?
Sample config file:
set xdata time
set xtics rotate
set xtics '1980-01-01 00:00',31536000
set timefmt "%Y-%m-%d %H:%M"
set format x "%Y-%m-%d"
set terminal png large size 1200,900
set grid
(...)
plot ["1994-01-01 01:00":"2006-12-31 24:00"] [:240.6] "outfiles/
AT0168A0000700500dymax.dat" using 1:3 title 'Smoothed line' with lines
lw 2 lc rgb "midnight-blue" smooth bezier,"outfiles/
AT0168A0000700500dymax.dat" using 1:3 title 'Measured values' with
points lc rgb "gray50" ps .2 pt 5
Result: http://tinyurl.com/6c7rnj
I am using gnuplot 4.3 patchlevel 0, which I just downloaded from CVS.
Thanks in advance, Hermann
> I want PNGs with major xtics for each year (on 1 Jan) and 11 minor
> xtics for the months in between. I understand that I can define a
> start point according to timefmt and an increment in seconds, but as
> the number of seconds per month and year varies... what can I do?
Set the <step> to 365.25 * 24 * 60 * 60. That should be easily good
enough to work on any range where a single tic per year actually works.
OTOH, I strongly suggest you just keep your fingers off this button.
The time/date data handling in gnuplot really works best with the
auto-generated ticking. A stepsize doesn't fit axes whose meaningful
divisions just aren't equidistant.
> Furthermore, when defining: set xtics '1980-01-01 00:00',31536000,
> then I only get xtics from 2000 onwards. Is this a bug which has
> something to do with gnuplot working internally with seconds since 1
> Jan 2000?
No. It's a bug in your script. You tried to use the timefmt
> set xtics '1980-01-01 00:00',31536000
before you defined it:
> set timefmt "%Y-%m-%d %H:%M"
The capability to parse strings as time data relies on the time input
format string being defined already. As you hadn't defined one yet,
parsing of your "set xtics" failed, and left the <start> parameter at
zero. Which, for the purpose of time/date data, means the millennium.
Thanks for pointing me to this mistake. Silly me.
> OTOH, I strongly suggest you just keep your fingers off this button.
> The time/date data handling in gnuplot really works best with the
> auto-generated ticking. A stepsize doesn't fit axes whose meaningful
> divisions just aren't equidistant.
Thanks for your strong suggestions. However, gnuplot (while working at
its best) often divides the year with 4 minor tics into 5 ... yes
what? More-than-2-months-but-less-than-a-quarter units?
I either have to explain this new period to the users of my plots or
explain to gnuplot how to divide the year into units that human beings
expect: days, weeks, months and quaters.
I'll see how far I get.
Hermann
> Thanks for your strong suggestions. However, gnuplot (while working at
> its best) often divides the year with 4 minor tics into 5 ... yes
> what? More-than-2-months-but-less-than-a-quarter units?
Care being more specific than "often"?
It looks like I have to row back and correct myself: in my case, all
auto-generated mxtics seem to represent periods of 2, 3, 4 or 6
months, depending on the length of the time series. It would however
be nice to have an option to force the generation of xtics/mxtics for
predefined periods of time, e.g. every week, month or quarter.
Hermann
> It would however
> be nice to have an option to force the generation of xtics/mxtics for
> predefined periods of time, e.g. every week, month or quarter.
I believe that this issue was taken care of recently.
The ChangeLog entry is
2008-05-08 Thomas Sefzick <th...@users.sourceforge.net>
* src/axis.c (setup_tics): If the user specified an explicit
tic interval on a timefmt axis, do not change this by calling
quantize_time_tics().
Bug #1908019
That's been available in the CVS version for some months, and will be
in 4.2.4 when it is released [real soon now].