Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

timecolumns of different format, using clause timecolumn(n) with explicit format specifiers

10 views
Skip to first unread message

Alex van der Spek

unread,
Dec 29, 2012, 7:02:14 AM12/29/12
to
I have a datafile like this:

+++++++++++++
Date Sunrise Sunset Daylength
1 December 2012, Saturday 08:28 16:34 08:05
2 December 2012, Sunday 08:29 16:33 08:03
3 December 2012, Monday 08:31 16:33 08:01
4 December 2012, Tuesday 08:32 16:32 08:00
5 December 2012, Wednesday 08:33 16:32 07:58
6 December 2012, Thursday 08:35 16:31 07:56
7 December 2012, Friday 08:36 16:31 07:55
+++++++++++++

Columns are separated by tab (\t) characters. Total of 4 columns.

I want to plot the Daylength versus the date. This presents a problem,
timefmt cannot be used as the columns have different formats. I am trying to
use timecolumn(n) with an explicit format expression which is part of the
using clause:


++++++++++++
plot 'sundat.txt' using (timecolumn(1)):(timecolumn(4)) "%[%d %B
%Y],%[%A]%[\t]%*[%H:%M]%[\t]%*[%H:%M]%[\t]%[%H:%M]" with lines
++++++++++++

Doesn't quite work. Any suggestions on how to do this. The C++ documentation
on scanf doesn't treat the time/date specifiers.

Thanks in andvance!
Alex van der Spek

Hans-Bernhard Bröker

unread,
Dec 29, 2012, 7:33:18 AM12/29/12
to
On 29.12.2012 13:02, Alex van der Spek wrote:
> I have a datafile like this:
>
> +++++++++++++
> Date Sunrise Sunset Daylength
> 1 December 2012, Saturday 08:28 16:34 08:05
> 2 December 2012, Sunday 08:29 16:33 08:03
> 3 December 2012, Monday 08:31 16:33 08:01
> 4 December 2012, Tuesday 08:32 16:32 08:00
> 5 December 2012, Wednesday 08:33 16:32 07:58
> 6 December 2012, Thursday 08:35 16:31 07:56
> 7 December 2012, Friday 08:36 16:31 07:55
> +++++++++++++
>
> Columns are separated by tab (\t) characters. Total of 4 columns.
>
> I want to plot the Daylength versus the date. This presents a problem,
> timefmt cannot be used as the columns have different formats.

Not so fast. timefmt is actually per-axis, i.e. you can

set xdata time
set ydata time
set timefmt x '%d %B %Y'
set timefmt x '%H:%M'
plot 'data' using 1:4

If that doesn't work out, you should probably try some variation of

plot 'data' u (strptime('%d %B %Y',strcolumn(1)):(strptime('%H:%M',
strcolumn(4))

> I am
> trying to use timecolumn(n) with an explicit format expression which is
> part of the using clause:

Sorry, but that really can't work. The {'format'} part of the using
specification only works for ordinary data. It doesn't mix with
time/date data at all.

Alex van der Spek

unread,
Dec 29, 2012, 8:58:31 AM12/29/12
to
Thank you! That worked!

gnuplot> help timefmt

does not show that timefmt can be specified independently for x and y. I
presume x2 and y2 can be given to?

The documentation for the using clause is explicit about the format part. It
can only contain float specifiers but the help about timecolumn seemed to
suggest the format specifier might be applicable to the timecolumn function.

Many thanks!
Alex van der Spek


"Hans-Bernhard Bröker" <HBBr...@t-online.de> wrote in message
news:ak868c...@mid.dfncis.de...
0 new messages