|
From: Fabien L. <laf...@gm...> - 2012-01-27 15:48:34
|
I want to plot something like: X(time) Ypoints 0 8 1 2 7 3 4 5 6 7 8 9 |
|
From: Fabien L. <laf...@gm...> - 2012-01-27 15:52:45
|
Sorry, It's an awkward manipulation. I finish the mail 2012/1/27 Fabien Lafont <laf...@gm...>: > I want to plot something like: > > > X(time) Ypoints > 0 8 > 1 > 2 7 > 3 6 > 4 4 > 5 > 6 > 7 7 > 8 2 > 9 10 In fact I've recorded some live datas and when I use genfromtxt() the blank parts are "translated" as 'nan' and I can't for example fit it with polynomials. |
|
From: Benjamin R. <ben...@ou...> - 2012-01-27 16:03:52
|
On Fri, Jan 27, 2012 at 9:52 AM, Fabien Lafont <laf...@gm...>wrote: > Sorry, It's an awkward manipulation. I finish the mail > > 2012/1/27 Fabien Lafont <laf...@gm...>: > > I want to plot something like: > > > > > > X(time) Ypoints > > 0 8 > > 1 > > 2 7 > > 3 6 > > 4 4 > > 5 > > 6 > > 7 7 > > 8 2 > > 9 10 > > In fact I've recorded some live datas and when I use genfromtxt() the > blank parts are "translated" as 'nan' and I can't for example fit it > with polynomials. > > If you plot the data, it should skip data points that are NaNs and you should see a break in the line IIRC. Is that not what you want? Ben Root |
|
From: Fabien L. <laf...@gm...> - 2012-01-27 16:11:20
|
Yes in fact it plot it well, but then I have a vector like:
[3702.1399999999999, nan, nan, nan, 3703.79, nan, nan, nan,
3704.6900000000001, 3704.8400000000001]
and it's impossible to fit it. It return 'nan'.
Ive tried:
for i in range(0,NbPts):
if column1[i] == nan:
column1[i].remove(nan)
column2[i].remove(nan)
to remove these points but it doesn't work
2012/1/27 Benjamin Root <ben...@ou...>:
> On Fri, Jan 27, 2012 at 9:52 AM, Fabien Lafont <laf...@gm...>
> wrote:
>>
>> Sorry, It's an awkward manipulation. I finish the mail
>>
>> 2012/1/27 Fabien Lafont <laf...@gm...>:
>> > I want to plot something like:
>> >
>> >
>> > X(time) Ypoints
>> > 0 8
>> > 1
>> > 2 7
>> > 3 6
>> > 4 4
>> > 5
>> > 6
>> > 7 7
>> > 8 2
>> > 9 10
>>
>> In fact I've recorded some live datas and when I use genfromtxt() the
>> blank parts are "translated" as 'nan' and I can't for example fit it
>> with polynomials.
>>
>
> If you plot the data, it should skip data points that are NaNs and you
> should see a break in the line IIRC. Is that not what you want?
>
> Ben Root
>
|
|
From: Benjamin R. <ben...@ou...> - 2012-01-27 16:17:18
|
On Fri, Jan 27, 2012 at 10:11 AM, Fabien Lafont <laf...@gm...>wrote: > Yes in fact it plot it well, but then I have a vector like: > [3702.1399999999999, nan, nan, nan, 3703.79, nan, nan, nan, > 3704.6900000000001, 3704.8400000000001] > and it's impossible to fit it. It return 'nan'. > > Ive tried: > > for i in range(0,NbPts): > if column1[i] == nan: > column1[i].remove(nan) > column2[i].remove(nan) > > to remove these points but it doesn't work > > You can't do equality tests with NaNs (us np.isnan(), instead). This question is more suited for the Numpy list. Ben Root |
|
From: Ethan G. <eth...@gm...> - 2012-01-27 16:53:19
|
On Jan 27, 2012, at 9:11 AM, Fabien Lafont wrote:
> Ive tried:
>
> for i in range(0,NbPts):
> if column1[i] == nan:
> column1[i].remove(nan)
> column2[i].remove(nan)
>
> to remove these points but it doesn't work
>
you are close, I think what you want is:
# assuming column1 and 2 are numpy arrays
import numpy as np
for i in range(0,NbPts):
if np.isnan(column1[i]):
column1=np.remove(column1,i,0)
column1=np.remove(column2,i,0)
>
> 2012/1/27 Benjamin Root <ben...@ou...>:
>> On Fri, Jan 27, 2012 at 9:52 AM, Fabien Lafont <laf...@gm...>
>> wrote:
>>>
>>> Sorry, It's an awkward manipulation. I finish the mail
>>>
>>> 2012/1/27 Fabien Lafont <laf...@gm...>:
>>>> I want to plot something like:
>>>>
>>>>
>>>> X(time) Ypoints
>>>> 0 8
>>>> 1
>>>> 2 7
>>>> 3 6
>>>> 4 4
>>>> 5
>>>> 6
>>>> 7 7
>>>> 8 2
>>>> 9 10
>>>
>>> In fact I've recorded some live datas and when I use genfromtxt() the
>>> blank parts are "translated" as 'nan' and I can't for example fit it
>>> with polynomials.
>>>
>>
>> If you plot the data, it should skip data points that are NaNs and you
>> should see a break in the line IIRC. Is that not what you want?
>>
>> Ben Root
>>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Jérôme <je...@jo...> - 2012-01-27 16:17:12
|
Fri, 27 Jan 2012 16:48:25 +0100 Fabien Lafont a écrit: > I want to plot something like: > > > X(time) Ypoints > 0 8 > 1 > 2 7 > 3 > 4 > 5 > 6 > 7 > 8 > 9 Sorry if I'm missing something, but can't you plot Y [8,7] against X [0,2] ? -- Jérôme |
|
From: Fabrice S. <si...@lm...> - 2012-01-27 16:24:43
|
What about masked arrays ? http://docs.scipy.org/doc/numpy/reference/maskedarray.html -- Fabrice Silva |
|
From: Fabien L. <laf...@gm...> - 2012-01-27 16:41:29
|
Thanks a lot, I'll try to remove the points using isnan() 2012/1/27 Fabrice Silva <si...@lm...>: > What about masked arrays ? > http://docs.scipy.org/doc/numpy/reference/maskedarray.html > > > -- > Fabrice Silva > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |