When using time data on the X axis, the major tics are rounded to start-of-month dates, even if the tics interval was specified as some round number of days. How do I force the tics to be placed at the specified interval?
Test file:
set term png size 800,200 font "arial,10"
set output "bug-timetics.png"
set timefmt "%Y-%m-%d"
set xdata time
set format x "%Y-%m-%d"
nweeks=6 # Spacing of major tics in weeks
set xtics "2011-12-18",nweeks7246060,"2014-12-31"
set mxtics nweeks
plot "-" using (timecolumn(1)):2 title "dots" with linespoints pt 7 ps 2
2012-07-25 10.00
2012-08-30 15.00
2013-01-02 8.00
e
quit
Note that the major tics should be exactly 6 weeks apart, but are being placed instead at (some) start-of-month days. The minor tics following each major tic are 7 days apart, as they they should, but start againg at every major tic and etend beyond the next major tic, so that they end up irregularly spaced too.
PS. I am using gnuplot 4.6 patchlevel 1
PS. the increment in "set xtics" should be "nweeks [asterisk] 7 [asterisk] 24 [asterisk] 60 [asterisk] 60". The asterisks got eaten as formatting codes.
I think the best approach is to not tell gnuplot that x is a time axis. That means you have to convert x-coordinat-in-seconds to a date yourself, but that's not so hard. This is easier in version 5, but so far as I know it is already possible in version 4.6.
So you want something like:
(moving this to Support Requests rather than Bugs)
Ticket moved from /p/gnuplot/bugs/1438/
Thanks!
I had to fiddle a bit and it ALMOST worked, but I wasn't able to suppress the automatic tics. It seems to ignore the "unset xtics", and "set xtics ( )" does not work either.
Yeah, the "set xtics add" in the loop does not erase the pre-existing xtics setting. So at the top of the script use "set xtics" to place a single tic somewhere off-screen. E.g. "set xtics (-999)"
Thanks! What about "unset xtics" and "set xtics ( )" not working; should I report them as bugs?
In what way are they not working?
Is it that you expect the sequence "unset xtics; set xtics add (<foo>)"
to be different from "set xtics; set xtics add (<foo>)"?
As to "set xtics ()", I am surprised that doesn't get flagged as an error.
I expected "unset xtics" to discard previously defined tics and suppress the automatic tics, so that "set xtics add ( ... )" would begin with an empty set of tics.
I expected "set xtics ()" to have the same effect as "unset xtics", namely discard previously set tics, turn off the automatic tics, and start with an empty set of tics.
I would expect "set xtics", with no other args, to turn on the default tics, which would be preserved by "set xtics add ( ... )" (and result in a mess).
While not explicitly allowed by the documentation, people would expect the notation "()", in that context, to be understood as an empty list of explicit labels.
While not explicitly allowed by the documentation, people would expect the notation "()", in that context, to be understood as an empty list of explicit labels.
Sounds reasonable. We can add that.