|
From: Alexander_P <sch...@is...> - 2007-10-08 13:39:18
|
Hello, i have a data file looking like this: 02:25:40 183.69 92.61 91.56 90.01 540.00 97.53 02:25:45 204.50 93.38 89.99 89.61 600.00 100.31 02:25:50 224.28 94.07 88.49 89.25 600.00 100.31 02:25:55 243.06 95.09 87.06 88.92 600.00 104.26 02:26:00 257.91 96.21 85.71 88.63 540.00 106.29 02:26:05 269.01 97.09 84.42 88.37 480.00 104.99 02:26:10 276.56 98.11 83.20 88.13 420.00 107.34 02:26:15 280.74 99.39 82.04 87.92 360.00 110.90 02:26:20 281.70 101.08 80.94 87.73 300.00 116.31 the time is in the first collumn and i want to plot 3:4 for example specifying a range on the time collumn ( for example ["02:00:00":"03:00:00"] ) i experimented with timefmt and set it to "%H:%M:%S" to match my timeformat but i was not able to do the 2d plot with specifying a range on the time... :/ any help appreciated ;) thanks in advance Alex -- View this message in context: http://www.nabble.com/plotting-2d-specifying-range-on-3rd-dimension-tf4588246.html#a13096817 Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2007-10-08 17:28:59
|
i searched through my old emails and found an old posting to
inf...@Da...
the question was:
>> How do I specify time range to generate a plot of data
>> for say time range "01/01/2000 00:00 to 01/02/2000 00:00 "
this was the answer:
> not so easy... it's a little bit tricky but it works:
> when using time data for plotting a 'set timefmt "..."' is used to tell
> gnuplot how to interpret the data. the 'set timefmt' is only useful in
> combination with 'set xdata time', that's what the manual says. it's not
> completely true, because without 'set xdata time' one can still interpret
> time
> data with 'timecolumn(.)' (not really documented, is similar to
> 'column(.)' within the
> 'using' modifier). internally gnuplot calculates time data into 'number of
> seconds since the beginning of the century', so we are lucky, the century
> has
> just started, and thus the numbers are low. so add the line:
> set timefmt "%d/%m/%Y %H:%M"
> to your script and replace the plot command by:
> plot [0:360][-5:5] [-5:5] 1,3,5, 'pol.txt' using \
> 4:(timecolumn(1)>=0?$3:1/0) t '' with lines
> (use lines to see what's happening). the trick is, allow values to be
> plotted
> only when a specific condition is fulfilled, using the ternary operator:
> if the condition is fulfilled everything between the '?' and the ':' is
> used,
> here: column 3 ($3), if it's not fulfilled what's following the ':' is
> used,
> here: 1/0 (= division by zero means 'not defined' to gnuplot, i.e. nothing
> is
> plotted).
> examples:
> 4:(timecolumn(1)>=0?$3:1/0) plots all data starting from 01/01/2000
> 00:00:00
> ('01/01/2000 00:00:00' is the second '0' of the new century)
> 4:(timecolumn(1)>0?$3:1/0) plots all data starting from 01/01/2000
> 00:00:01
> (your first datapoint will disappear)
> 4:(timecolumn(1)>(3600*6)?$3:1/0) plots all data starting from 01/01/2000
> 06:00:01
> (and the second datapoint will disappear)
> 4:(timecolumn(1)>=0?(timecolumn(1)<=(24*3600)?$3:1/0):1/0)
> (plots the data between 01/01/2000 00:00:00 and 01/02/2000 00:00:00)
>
> it's not as easy as a 'set xrange [.:.]' but there is a work-around. you
> can
> use two variables e.g. 'a' and 'b' in your plot command:
> ... using 4:(timecolumn(1)>=a?(timecolumn(1)<=b?$3:1/0):1/0) ...
> and these variables you can set in a script or at the gnuplot command
> line. for
> the last of the above examples you would write
> a = 0
> b = 24*3600
the answer was for gnuplot 3.7, so maybe some things are outdated, but the
principle is the same for gnuplot 4.x.
one more remark:
to get the 'number of seconds' for a specific date use the 'test time'
command:
gnuplot> test time "%d.%m.%Y %H:%M:%S" "08.10.2007 19:45:55"
internal = 245187955.000000 - 8/10/7::19:45:55 , wday=-1, yday=-1
convert back "08.10.2007 19:45:55" - 8/10/7::19:45:55 , wday=1, yday=280
'internal' is the number of seconds since 1.1.2000 00:00:00
Alexander_P wrote:
>
> Hello,
> i have a data file looking like this:
>
> 02:25:40 183.69 92.61 91.56 90.01 540.00 97.53
> 02:25:45 204.50 93.38 89.99 89.61 600.00 100.31
> 02:25:50 224.28 94.07 88.49 89.25 600.00 100.31
> 02:25:55 243.06 95.09 87.06 88.92 600.00 104.26
> 02:26:00 257.91 96.21 85.71 88.63 540.00 106.29
> 02:26:05 269.01 97.09 84.42 88.37 480.00 104.99
> 02:26:10 276.56 98.11 83.20 88.13 420.00 107.34
> 02:26:15 280.74 99.39 82.04 87.92 360.00 110.90
> 02:26:20 281.70 101.08 80.94 87.73 300.00 116.31
>
>
> the time is in the first collumn and i want to plot 3:4 for example
> specifying a range on the time collumn ( for example
> ["02:00:00":"03:00:00"] )
>
> i experimented with timefmt and set it to "%H:%M:%S" to match my
> timeformat but i was not able to do the 2d plot with specifying a range on
> the time... :/
>
> any help appreciated ;)
> thanks in advance
>
> Alex
>
--
View this message in context: http://www.nabble.com/plotting-2d-specifying-range-on-3rd-dimension-tf4588246.html#a13101234
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: <HBB...@t-...> - 2007-10-08 21:00:25
|
Alexander_P wrote: > the time is in the first collumn and i want to plot 3:4 for example > specifying a range on the time collumn ( for example ["02:00:00":"03:00:00"] > ) This contains at least two independent problems. 1) Specifying a range on a column you're not actually plotting. You need extended "using" specifications for that, like plot 'data' using ($1>min1 && $1<max1: $2 : 0/0):3 2) Interpreting a column as time data even though you're not actually plotting it. "set timefmt" only directly applies to input coordinates, but in your plot, column #1 isn't one of them. This would need the suggested, but (as yet) unimplemented string processing function "strptime()". If you're lucky, you might manage to use 'timecolumn()' and 'set timefmt', but it's going to be quite tricky. |
|
From: Alexander_P <sch...@is...> - 2007-10-12 15:16:45
|
Thank you two! you helped me a lot... especially the extended using syntax ;) -- View this message in context: http://www.nabble.com/plotting-2d-specifying-range-on-3rd-dimension-tf4588246.html#a13176993 Sent from the Gnuplot - User mailing list archive at Nabble.com. |