Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #3914
| From | Chris Elvidge <chris@mshome.net> |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: Missing points in multi line plot not being omitted |
| Date | 2018-03-10 17:01 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <p81323$t10$1@dont-email.me> (permalink) |
| References | (2 earlier) <p7upll$74f$1@dont-email.me> <p800sb$2e6$1@dont-email.me> <p80a6s$n95$1@dont-email.me> <p80ed7$hou$1@dont-email.me> <p811qe$jn7$1@dont-email.me> |
On 10/03/2018 04:40 pm, Jörg Buchholz wrote:
> On 10.03.2018 12:09, Chris Elvidge wrote:
>> On 10/03/2018 09:57 am, Jörg Buchholz wrote:
>>> On 10.03.2018 08:18, Ethan A Merritt wrote:
>>>> Jörg Buchholz wrote:
>>>>
>>>>> On 09.03.2018 19:48, Marius Schamschula wrote:
>>>>>
>>>>>>
>>>>>> FYI, I'm using version 5.2 patchlevel 2 under FreeBSD, so indeed
>>>>>> there should not be any quotes around the NaN
>>>>>>
>>>>>> Dealing with single points is easy: add a marker. My problem is
>>>>>> having lines where they shouldn't be.
>>>>>>
>>>>> I have compiled the 5.2.2 Version and it confuse me.
>>>>>
>>>>> set style data linespoints
>>>>> set datafile missing NaN
>>>>> plot '-' u 1:2
>>>>> input data ('e' ends) > 1 10
>>>>> input data ('e' ends) > 2 20
>>>>> input data ('e' ends) > 3 NaN
>>>>> input data ('e' ends) > 4 40
>>>>> input data ('e' ends) > 5 50
>>>>> input data ('e' ends) > e
>>>>>
>>>>> There is no gap in the output.
>>>>
>>>> Correct. There is no gap because the NaN point is treated as missing.
>>>> From the docs under "help missing"
>>>>
>>>> "invalid data causes a gap in a line drawn through sequential
>>>> data points; missing data does not."
>>>>
>>>>
>>>>> unset datafile missing NaN
>>>>> plot '-' u 1:2
>>>>> input data ('e' ends) > 1 10
>>>>> input data ('e' ends) > 2 20
>>>>> input data ('e' ends) > 3 NaN
>>>>> input data ('e' ends) > 4 40
>>>>> input data ('e' ends) > 5 50
>>>>> input data ('e' ends) > e
>>>>>
>>>>> There is a gap between 2 - 4 in the output.
>>>>
>>>> Yes, because now the point is not "missing". It is "invalid".
>>>>
>>>>> In the 5.2 Documentation there are some examples for the "set datafile
>>>>> missing option". Only the examples with "NaN" direct in the data gives
>>>>> a gap.
>>>>
>>>> Correct.
>>>>
>>>>> So can you put a "NaN" into your data?
>>>>>
>>>>> IMHO the 5.0 Version works nicer, or more than I expected. Or is it a
>>>>> bug?
>>>>
>>>>> Jörg
>>>>
>>>> Perhaps a misunderstanding. Let me try re-phrasing...
>>>>
>>>> "Missing" data acts as if no entry at that x coordinate was present
>>>> in the data file at all, so it has no effect on the line being drawn.
>>>>
>>>> A gap in the line indicates that data at that x coordinate was present,
>>>> but invalid.
>>>>
>>>> The special command "set datafile missing NaN" tells the program
>>>> to treat invalid data as if it were missing (no gap).
>>>>
>>>> Ethan
>>>>
>>> Thanks for your explanation. So it was a misunderstanding. But the
>>> behave from gnuplot 5.0 is nice and easy to handle.
>>>
>>> So for gnuplot 5.2 the only solution is something like "sed -i
>>> 's/?/NaN/g' datafile.dat" before plotting the data or in a pipe?
>>>
>>> Jörg
>>>
>>
>> Or use "set datafile missing ?" (or "set datafile missing '?'") ??
>
> No, this don't give a gap.
>
>> From the manual: There is no default character for missing, but in many
>> cases any non-parsible string of characters found where a numerical
>> value is expected will be treated as missing data.
>>
>> So will a "?" in the data be treated as missing, even without the "set
>> datafile missing" line. plot '-' using 1:($2) suggests it will.
>
> Yes, that works. So, if I understand the problem from Marius correct, he
> must only disable the "set datafile missing ..." command and write the
> Y-column like "($3)".
>
> I put his data example into the file "wind.data" and the following gives
> a line with gaps in the "Gust".
>
> set grid
> gnuplot> set time
> gnuplot> set xdata time
> gnuplot> set timefmt "%Y-%m-%d:%H:%M:%S"
> gnuplot> unset timestamp
> plot 'wind.data' u 1:($2) t 'Wind' w lines lt rgb "blue", '' u 1:($3) t
> 'Gust' w lines
>
> gnuplot Version 5.2 patchlevel 2
>
> And the good thing for me: I have learned how to plot data with a gap in
> the line with gnuplot 5.2
>
>
> Jörg
>
>
I did that, too - plot 'data' u 1:2 w lines t "Wind", '' u 1:($3) w
lines t "Gusts".
A problem I found was that the last data point "2018-03-07:12:53:00 12
18" did not produce anything for the gust at that time - no line to plot
as the previous "gust" was missing - cured by using linespoints for Gusts
--
Chris Elvidge, England
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar
Missing points in multi line plot not being omitted Marius Schamschula <mschamschula@gmail.com> - 2018-03-07 10:33 -0800
Re: Missing points in multi line plot not being omitted Jörg Buchholz <bookwood4new@freenet.de> - 2018-03-08 11:39 +0100
Re: Missing points in multi line plot not being omitted Marius Schamschula <mschamschula@gmail.com> - 2018-03-08 06:35 -0800
Re: Missing points in multi line plot not being omitted Chris Elvidge <chris@mshome.net> - 2018-03-08 16:24 +0000
Re: Missing points in multi line plot not being omitted Jörg Buchholz <bookwood4new@freenet.de> - 2018-03-08 20:10 +0100
Re: Missing points in multi line plot not being omitted Ethan Merritt <sfeam@users.sf.net> - 2018-03-08 19:54 +0000
Re: Missing points in multi line plot not being omitted Chris Elvidge <chris@mshome.net> - 2018-03-08 20:40 +0000
Re: Missing points in multi line plot not being omitted Marius Schamschula <mschamschula@gmail.com> - 2018-03-09 10:48 -0800
Re: Missing points in multi line plot not being omitted Jörg Buchholz <bookwood4new@freenet.de> - 2018-03-09 21:09 +0100
Re: Missing points in multi line plot not being omitted Ethan A Merritt <EAMerritt@gmail.com> - 2018-03-09 23:18 -0800
Re: Missing points in multi line plot not being omitted Jörg Buchholz <bookwood4new@freenet.de> - 2018-03-10 10:57 +0100
Re: Missing points in multi line plot not being omitted Chris Elvidge <chris@mshome.net> - 2018-03-10 11:09 +0000
Re: Missing points in multi line plot not being omitted Jörg Buchholz <bookwood4new@freenet.de> - 2018-03-10 17:40 +0100
Re: Missing points in multi line plot not being omitted Chris Elvidge <chris@mshome.net> - 2018-03-10 17:01 +0000
Re: Missing points in multi line plot not being omitted Jörg Buchholz <bookwood4new@freenet.de> - 2018-03-11 09:47 +0100
Re: Missing points in multi line plot not being omitted Chris Elvidge <chris@mshome.net> - 2018-03-11 10:41 +0000
csiph-web