|
From: William Xu <wil...@gm...> - 2007-11-01 03:42:18
|
>From the manual, i manage to do the filtering with the following trick: ,---- | plot 'result.log' using ($4 == 1 $3 : 1/0):5 title '1 session' with linespoints `---- However, seems `with linespoints' part doesn't work, it display as dots. What's the problem here? -- William |
|
From: <HBB...@t-...> - 2007-11-01 21:20:22
|
William Xu wrote: >>From the manual, i manage to do the filtering with the following trick: ... what filtering? You've removed all context, so it's hard to know what you might be talking about. > ,---- > | plot 'result.log' using ($4 == 1 $3 : 1/0):5 title '1 session' with linespoints > `---- > > However, seems `with linespoints' part doesn't work, it display as > dots. What's the problem here? The problem is that you hwave way too many undefined points in your input. Lines can only be drawn between consequtive valid points. Looks like there are no two valid points without an invalid one between them, in your entire file. In this case, a simple 'every 2' filter might work better than the above. |
|
From: William Xu <wil...@gm...> - 2007-11-02 03:52:19
|
Hans-Bernhard Bröker <HBB...@t-...> writes:
> William Xu wrote:
>>>From the manual, i manage to do the filtering with the following trick:
>
> ... what filtering? You've removed all context, so it's hard to know
> what you might be talking about.
For example,
,----
| #a b c
| 1 3 5
| 1 4 9
| 2 3 7
| 1 2 6
`----
I'd like to draw (b, c) points where a == 1.
>> ,----
>> | plot 'result.log' using ($4 == 1 $3 : 1/0):5 title '1 session' with linespoints
>> `----
>>
>> However, seems `with linespoints' part doesn't work, it display as
>> dots. What's the problem here?
>
> The problem is that you hwave way too many undefined points in your
> input. Lines can only be drawn between consequtive valid points. Looks
> like there are no two valid points without an invalid one between them,
> in your entire file.
The data file should be okay. Anyway, i find i can embed shell command
into plot, so using awk, it draws linespoints as expected.
,----
| plot "< awk '{ if($4==1) print $1, $2, $3, $4, $5}' result.log" using 3:5 title '1 session' with linespoints
`----
which should do the same as:
>> ,----
>> | plot 'result.log' using ($4 == 1 $3 : 1/0):5 title '1 session' with linespoints
>> `----
right?
--
William
|
|
From: <HBB...@t-...> - 2007-11-03 21:25:54
|
William Xu wrote:
> For example,
>
> ,----
> | #a b c
> | 1 3 5
> | 1 4 9
> | 2 3 7
> | 1 2 6
> `----
This example fits neither your given command (no columns 4 and 5), nor
the claimed behaviour. It does plot a line (from (3,7) to (2,6)) after
being adjusted to the modified format:
gnuplot> p '-' u ($1==1? $2:1/0):3 w lp
input data ('e' ends) > 1 3 5
input data ('e' ends) > 1 4 9
input data ('e' ends) > 2 3 7
input data ('e' ends) > 1 2 6
input data ('e' ends) > e
> The data file should be okay.
How do you know that, given that the only symptoms you actually
described say otherwise?
> Anyway, i find i can embed shell command
> into plot, so using awk, it draws linespoints as expected.
> ,----
> | plot "< awk '{ if($4==1) print $1, $2, $3, $4, $5}' result.log" using 3:5 title '1 session' with linespoints
> `----
> which should do the same as:
>>> ,----
>>> | plot 'result.log' using ($4 == 1 $3 : 1/0):5 title '1 session' with linespoints
>>> `----
>
> right?
No. Data that's not there at all (because 'awk' ate it) is not quite
the same as data with infinite or undefined coordinates.
|
|
From: William Xu <wil...@gm...> - 2007-11-05 01:51:59
|
Hans-Bernhard Bröker <HBB...@t-...> writes: > No. 1/0 is an invalid coordinate. But that's still not the same as the > total absense of an entire datapoint. An input line with invalid > coordinates works like an empty input line, a.k.a. "blank record". See > "help datafile" about the effect of blank records. Okay, i found the "blank record": ,---- | In datafiles, blank records (records with no characters other than | blanks and a newline and/or carriage return) are significant -- pairs of | blank records separate indexes (see plot datafile index (p. [*])). Data | separated by double blank records are treated as if they were in | separate data files. `---- It simply says "blank"(whitespaces, newline, etc) records are "blank records", but it doesn't say that infinite/undefined coordinates are also "blank records". In "using" section, I also found no hint indicating "blank records", (which i quoted previously) ,---- | One trick is to use the ternary ?: operator to filter data: | | | plot 'file' using 1:($3>10 ? $2 : 1/0) | | | which plots the datum in column two against that in column one provided | the datum in column three exceeds ten. 1/0 is undefined; gnuplot quietly | ignores undefined points, so unsuitable points are suppressed. `---- Am I missing something? -- William |
|
From: William Xu <wil...@gm...> - 2007-11-04 01:56:03
|
Hans-Bernhard Bröker <HBB...@t-...> writes: >> which should do the same as: >>>> ,---- >>>> | plot 'result.log' using ($4 == 1 $3 : 1/0):5 title '1 session' with linespoints >>>> `---- >> >> right? > > No. Data that's not there at all (because 'awk' ate it) is not quite > the same as data with infinite or undefined coordinates. Oh, so you mean that in ($4 == 1 ? $3 : 1/0):5, when $4 != 1, even (1/0):5 is a valid coordinate? I was thinking that it could be simply ignored by plot. I was following this from the manual: ,----[ http://www.gnuplot.info/docs/node133.html ] | One trick is to use the ternary ?: operator to filter data: | | | plot 'file' using 1:($3>10 ? $2 : 1/0) | | | which plots the datum in column two against that in column one provided | the datum in column three exceeds ten. 1/0 is undefined; gnuplot quietly | ignores undefined points, so unsuitable points are suppressed. `---- -- William |
|
From: <HBB...@t-...> - 2007-11-04 19:20:29
|
William Xu wrote: > Hans-Bernhard Bröker <HBB...@t-...> writes: >>> which should do the same as: >>>>> ,---- >>>>> | plot 'result.log' using ($4 == 1 $3 : 1/0):5 title '1 session' with linespoints >>>>> `---- >>> right? >> No. Data that's not there at all (because 'awk' ate it) is not quite >> the same as data with infinite or undefined coordinates. > Oh, so you mean that in ($4 == 1 ? $3 : 1/0):5, when $4 != 1, even > (1/0):5 is a valid coordinate? No. 1/0 is an invalid coordinate. But that's still not the same as the total absense of an entire datapoint. An input line with invalid coordinates works like an empty input line, a.k.a. "blank record". See "help datafile" about the effect of blank records. |