[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: partial plot
From: |
Henry F. Mollet |
Subject: |
Re: partial plot |
Date: |
Thu, 18 Mar 2004 10:58:34 -0800 |
User-agent: |
Microsoft-Entourage/10.1.1.2418 |
What am I missing? The two plots as per below are identical as NaN is
ignored in the second plot. I'm using
GNU Octave, version 2.1.46 (powerpc-apple-darwin6.6).
Calling Gnuplot, calling AquaTerm on Mac 10.2.8.
Henry
octave:10> plot (x,y)
octave:11> gset term aqua 1
octave:12> plot (x(!isnan(y)),y(!isnan(y)))
on 3/18/04 8:02 AM, Miquel Cabanas at address@hidden wrote:
> hi,
>
> try using find() and isnan() to select valid items in the
> y-vector and map that selection to the x-vector. Note that
> find is not always required. For instance,
>
> octave:1> y = [10, -20, NaN, -40, 50, NaN, 70, -80];
> octave:2> !isnan(y)
> ans =
>
> 1 1 0 1 1 0 1 1
>
> octave:3> y(!isnan(y))
> ans =
>
> 10 -20 -40 50 70 -80
>
> octave:4> x = 1:1:length(y)
> x =
>
> 1 2 3 4 5 6 7 8
>
> octave:5> x(!isnan(y))
> ans =
>
> 1 2 4 5 7 8
>
> octave:6> plot( x(!isnan(y), y(!isnan(y) )
>
>
> Miquel
>
>
>
> On Thu, Mar 18, 2004 at 07:52:56AM -0600, Pascal A. Dupuis wrote:
>> After some computation I obtain a matrix of values I wish to plot. But
>> some of the values are not reliable, and I can define a logical matrix
>> (matrix of ones and zeros) telling if the corresponding result is
>> valid or not.
>>
>> I would like to have a plot containing only the valid values.
>> I tried:
>> - plot(value(Is_valid)) -> this does not work as the result is a
>> column vector
>> - Is_nvalid = Is_valid == 0; value(Is_nvalid)=NA -> but this does
>> not work either, as NA values are strangely intepolated.
>>
>> What I would like is that values flagged as invalid are not plotted,
>> yet the x-abscissa is incremented by one unit. For instance,
>> plot([-2 NA -1]) should join the pair (1, -2) and (3, -1) instead of
>> (1, -2) and (2, -1). Is there some way to achieve this other than
>> plotting the matrix rows by rows ?
>>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------