|
From: Cameron H. <ca...@ne...> - 2008-03-03 06:24:15
|
Hi folks, I'm using the Debian version of gnuplot 4.2 patchlevel 2. I have a file (data.dat) with two columns. The first contains dates and the other contains measured data: 03/03/2007 89.8 04/04/2007 85.4 05/05/2007 79.0 12/06/2007 78.3 18/07/2007 77.0 13/09/2007 65.6 29/12/2007 65.0 I wish to graph my data (y axis) against the date (x axis). I want the x axis to show day of the month and the month, and increment weekly. So I use the following list of commands: set xdata time set timefmt "%d/%m/%Y" set format x "%d/%m" set xtics "03/03/2007",604800 # number of seconds in a week plot "data.dat" using 1:2 notitle The output isn't what I expect. The major tics all seem to round to the first day of the month and several minor tics appear after each major. If I change a few things around --- for example, change the x format to other units, change the increment size, etc, the same thing happens. All xtics round to the nearest first of the month. The data itself plots correctly I've looked through the documentation but I seem to be missing something fairly obvious. Can anyone help? -- ============================================= Cameron Horsburgh ============================================= |
|
From: Thomas S. <t.s...@fz...> - 2008-03-03 11:40:16
|
if your xrange is 20 weeks or lower , e.g.
set xrange ["01/01/2007":"20/05/2007"]
everything works as expected, but if you exceed 20 weeks,
set xrange ["01/01/2007":"21/05/2007"]
xtics are placed at 'beginning of month' and mxtics are drawn
at wrong positions.
this behaviour has nothing to do with the actual number of tics
on the x-axis.
it seems to be some mechanism in 'axis.c' which should prevent
the axis from getting overcrowded with tics.
(see 'quantize_time_tics' in 'axis.c' which is calling
'quantize_duodecimal_tics' or - as in your case -
'quantize_normal_tics')
don't know how to solve this :-(
thomas
Cameron Horsburgh wrote:
>
> Hi folks,
>
> I'm using the Debian version of gnuplot 4.2 patchlevel 2.
>
> I have a file (data.dat) with two columns. The first contains
> dates and the other contains measured data:
>
> 03/03/2007 89.8
> 04/04/2007 85.4
> 05/05/2007 79.0
> 12/06/2007 78.3
> 18/07/2007 77.0
> 13/09/2007 65.6
> 29/12/2007 65.0
>
> I wish to graph my data (y axis) against the date (x axis).
> I want the x axis to show day of the month and the month, and
> increment weekly. So I use the following list of commands:
>
>
>
> set xdata time
> set timefmt "%d/%m/%Y"
> set format x "%d/%m"
> set xtics "03/03/2007",604800 # number of seconds in a week
> plot "data.dat" using 1:2 notitle
>
>
>
> The output isn't what I expect. The major tics all seem to round to
> the first day of the month and several minor tics appear after each
> major. If I change a few things around --- for example, change the x
> format to other units, change the increment size, etc, the same thing
> happens. All xtics round to the nearest first of the month.
>
> The data itself plots correctly
>
> I've looked through the documentation but I seem to be missing
> something fairly obvious. Can anyone help?
>
> --
>
> =============================================
> Cameron Horsburgh
>
> =============================================
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gnuplot-info mailing list
> Gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
>
--
View this message in context: http://www.nabble.com/Problem-with-date-format-tp15798572p15799973.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: Thomas S. <t.s...@fz...> - 2008-03-03 16:52:32
|
...it's not so easy to repair...
what happens:
in 'axis.c':
'setup_tics' is called. and because 'timelevel[axis]' is not set
'quantize_time_tics' is used to set 'timelevel[axis]' as a byproduct.
and if 'quantize_time_tics' decides to set
timelevel[axis] = TIMELEVEL_MONTHS
because the axis range is too large (more than 20 weeks in the example
below), then the tics increment may still be 1 week (604800s) and the
loop to produce the tics is iterating correctly in 'gen_tics',
BUT 'time_tic_just' is called for each tic, adjusting the tic to a grid
based
on 'timelevel[axis]' which in this case is 'TIMELEVEL_MONTHS', i.e. all
four tics per month fall on the 1st day of the month.
to repair this 'timelevel[axis]' should be set according to the tics
increment
specified by the user, so something like in the subroutine 'setup_tics' in
'axis.c' could work:
if (this->is_timedata && ticdef->type == TIC_SERIES)
- quantize_time_tics(axis, tic, fabs(this->max - this->min), 20);
+ {
+ if (tic >= 365*24*60*60.) timelevel[axis] = TIMELEVEL_YEARS;
+ else if (tic >= 28*24*60*60.) timelevel[axis] = TIMELEVEL_MONTHS;
+ else if (tic >= 7*24*60*60.) timelevel[axis] = TIMELEVEL_WEEKS;
+ else if (tic >= 24*60*60.) timelevel[axis] = TIMELEVEL_DAYS;
+ else if (tic >= 60*60.) timelevel[axis] = TIMELEVEL_HOURS;
+ else if (tic >= 60.) timelevel[axis] = TIMELEVEL_MINUTES;
+ else timelevel[axis] = TIMELEVEL_SECONDS;
+ }
Thomas Sefzick wrote:
>
> if your xrange is 20 weeks or lower , e.g.
>
> set xrange ["01/01/2007":"20/05/2007"]
>
> everything works as expected, but if you exceed 20 weeks,
>
> set xrange ["01/01/2007":"21/05/2007"]
>
> xtics are placed at 'beginning of month' and mxtics are drawn
> at wrong positions.
>
> this behaviour has nothing to do with the actual number of tics
> on the x-axis.
>
> it seems to be some mechanism in 'axis.c' which should prevent
> the axis from getting overcrowded with tics.
> (see 'quantize_time_tics' in 'axis.c' which is calling
> 'quantize_duodecimal_tics' or - as in your case -
> 'quantize_normal_tics')
>
> don't know how to solve this :-(
>
> thomas
>
>
> Cameron Horsburgh wrote:
>>
>> Hi folks,
>>
>> I'm using the Debian version of gnuplot 4.2 patchlevel 2.
>>
>> I have a file (data.dat) with two columns. The first contains
>> dates and the other contains measured data:
>>
>> 03/03/2007 89.8
>> 04/04/2007 85.4
>> 05/05/2007 79.0
>> 12/06/2007 78.3
>> 18/07/2007 77.0
>> 13/09/2007 65.6
>> 29/12/2007 65.0
>>
>> I wish to graph my data (y axis) against the date (x axis).
>> I want the x axis to show day of the month and the month, and
>> increment weekly. So I use the following list of commands:
>>
>>
>>
>> set xdata time
>> set timefmt "%d/%m/%Y"
>> set format x "%d/%m"
>> set xtics "03/03/2007",604800 # number of seconds in a week
>> plot "data.dat" using 1:2 notitle
>>
>>
>>
>> The output isn't what I expect. The major tics all seem to round to
>> the first day of the month and several minor tics appear after each
>> major. If I change a few things around --- for example, change the x
>> format to other units, change the increment size, etc, the same thing
>> happens. All xtics round to the nearest first of the month.
>>
>> The data itself plots correctly
>>
>> I've looked through the documentation but I seem to be missing
>> something fairly obvious. Can anyone help?
>>
>> --
>>
>> =============================================
>> Cameron Horsburgh
>>
>> =============================================
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Gnuplot-info mailing list
>> Gnu...@li...
>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Problem-with-date-format-tp15798572p15808203.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|