I'm having trouble plotting data with NaN values. My plot has lines and
markers and usually both are skipped for NaN values. But when I have
more than 127 data a line is drawn from the last non-NaN to the next.
I read somewhere about a similar issue (maybe here? sorry I can't find
it just now), it seems like it has to do with some optimization
performed for large datasets and the use if lineto instead of moveto or
something like that. It was supposed to be fixed in 0.98.2 but I'm using
0.98.3 from Benjamin Drung's PPA (http://ppa.launchpad.net/bdrung).
This code shows the difference between plotting 127 and 128 data (look
at the left of each figure):
import pylab as pl
x = pl.random(128)
x[4:7] = pl.NaN
y = x[:-1]
pl.figure(1)
pl.plot(x, '-o')
pl.grid(True)
pl.figure(2)
pl.plot(y, '-o')
pl.grid(True)
pl.show()
Proper NaN handling has been a long and winding road.
This particuar bug you're running into was fixed about a week *after* the 0.98.3 release. Here's the patch:
So SVN trunk currently works. The patch against 0.98.3 is non-trivial -- there were actually many changes throughout the code to make all this work, so there isn't an easy workaround, and in any case requires a recompile.
If you can build from SVN, that's what I would suggest -- otherwise wait for the 0.98.4 release (I don't believe we have an ETA on that, yet).
Cheers,
Mike
Goyo wrote:
···
I'm having trouble plotting data with NaN values. My plot has lines and
markers and usually both are skipped for NaN values. But when I have
more than 127 data a line is drawn from the last non-NaN to the next.
I read somewhere about a similar issue (maybe here? sorry I can't find
it just now), it seems like it has to do with some optimization
performed for large datasets and the use if lineto instead of moveto or
something like that. It was supposed to be fixed in 0.98.2 but I'm using
0.98.3 from Benjamin Drung's PPA (Benjamin Drung in Launchpad).
This code shows the difference between plotting 127 and 128 data (look
at the left of each figure):
import pylab as pl
x = pl.random(128)
x[4:7] = pl.NaN
y = x[:-1]
pl.figure(1)
pl.plot(x, '-o')
pl.grid(True)
pl.figure(2)
pl.plot(y, '-o')
pl.grid(True)
pl.show()
Is this a known issue? Is there any workaround?
Thanks
Goyo
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net matplotlib-users List Signup and Options
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
So SVN trunk currently works. The patch against 0.98.3 is non-trivial
-- there were actually many changes throughout the code to make all this
work, so there isn't an easy workaround, and in any case requires a
recompile.
If you can build from SVN, that's what I would suggest -- otherwise wait
for the 0.98.4 release (I don't believe we have an ETA on that, yet).
Cheers,
Mike
Goyo wrote:
> I'm having trouble plotting data with NaN values. My plot has lines and
> markers and usually both are skipped for NaN values. But when I have
> more than 127 data a line is drawn from the last non-NaN to the next.
>
> I read somewhere about a similar issue (maybe here? sorry I can't find
> it just now), it seems like it has to do with some optimization
> performed for large datasets and the use if lineto instead of moveto or
> something like that. It was supposed to be fixed in 0.98.2 but I'm using
> 0.98.3 from Benjamin Drung's PPA (Benjamin Drung in Launchpad).
>
> This code shows the difference between plotting 127 and 128 data (look
> at the left of each figure):
>
> import pylab as pl
> x = pl.random(128)
> x[4:7] = pl.NaN
> y = x[:-1]
> pl.figure(1)
> pl.plot(x, '-o')
> pl.grid(True)
> pl.figure(2)
> pl.plot(y, '-o')
> pl.grid(True)
> pl.show()
>
> Is this a known issue? Is there any workaround?
>
> Thanks
>
> Goyo
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options
>