|
From: Thomas S. <t.s...@fz...> - 2011-01-07 15:11:56
|
plot 'datafile.dat' using 1:($3-$2)
doesn't work with time data.
use
... using 'timecolumn(3)-timecolumn(2)'
instead, BUT since you are using different time formats for
x and y this will not work, too.
'timecolumn()' can only use the time format of one column, which is
assigned to one coordinate, but you are dealing with two columns.
you could use something like in my previous reply, a little bit extended:
unset ydata
plot "ts.dat" using 1:( \
s=stringcolumn(2),n=strstrt(s,":"), \
t=stringcolumn(3),m=strstrt(t,":"), \
t[1:m-1]+t[m+1:]/60.-s[1:n-1]-s[n+1:]/60.) w lp
Steffen-21 wrote:
>
> Wonderful! That works and is even smarter.
> But I stumble over the next problem connected with time data:
> If a have a file with date, sunrise and sunset time in three columns
> like this:
> 2010-12-02 7:53 15:55
> 2010-12-03 7:55 15:54
> 2010-12-06 7:59 15:53
> 2010-12-07 8:00 15:53
> 2010-12-09 8:02 15:52
> 2010-12-10 8:04 15:52
> and I want to plot the length of the day, i.e. sunset-sunrise then
> plot 'datafile.dat' using 1:($3-$2)
> does not produce the desired result. It seems that every calculation on
> time formatted columns does not produce the expected results. How should
> calculations with dates/times be done?
> Steffen
>
>
> Am 06.01.2011 21:35, schrieb Hans-Bernhard Bröker:
>> On 06.01.2011 00:23, da...@la... wrote:
>>> currently gnuplot only supports time on the X axis,
>> I wonder what made believe that.
>>
>>> what you would need to
>>> do is to manipulate the data before gnuplot tries to use it.
>> No. This works:
>>
>> gnuplot> set xdata time
>> gnuplot> set ydata time
>> gnuplot> set timefmt x '%Y-%m-%d'
>> gnuplot> set timefmt y '%H:%M'
>> gnuplot> p '-' u 1:2 w lp
>> input data ('e' ends)> 2010-12-02 7:53
>> input data ('e' ends)> 2010-12-03 7:55
>> input data ('e' ends)> 2010-12-06 7:59
>> input data ('e' ends)> 2010-12-07 8:00
>> input data ('e' ends)> e
>> gnuplot>
>>
>>
>> ------------------------------------------------------------------------------
>> Learn how Oracle Real Application Clusters (RAC) One Node allows
>> customers
>> to consolidate database storage, standardize their database environment,
>> and,
>> should the need arise, upgrade to a full multi-node Oracle RAC database
>> without downtime or disruption
>> http://p.sf.net/sfu/oracle-sfdevnl
>> _______________________________________________
>> gnuplot-info mailing list
>> gnu...@li...
>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
>
> ------------------------------------------------------------------------------
> Gaining the trust of online customers is vital for the success of any
> company
> that requires sensitive data to be transmitted over the Web. Learn how
> to
> best implement a security strategy that keeps consumers' information
> secure
> and instills the confidence they need to proceed with transactions.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
>
--
View this message in context: http://old.nabble.com/Need-help%3A-Time-date-format-tp30599656p30615052.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|