|
From: <ef...@us...> - 2008-08-06 18:06:24
|
Revision: 5981
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5981&view=rev
Author: efiring
Date: 2008-08-06 18:06:21 +0000 (Wed, 06 Aug 2008)
Log Message:
-----------
Check for isfinite in get_path_extents.
This is part of an experiment to make nan and inf be ignored
equally throughout plotting; it may turn out to be unnecessary,
in which case it should be reverted for the sake of efficiency.
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/nan_test.py
trunk/matplotlib/src/_path.cpp
Modified: trunk/matplotlib/examples/pylab_examples/nan_test.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/nan_test.py 2008-08-06 17:42:59 UTC (rev 5980)
+++ trunk/matplotlib/examples/pylab_examples/nan_test.py 2008-08-06 18:06:21 UTC (rev 5981)
@@ -3,10 +3,12 @@
Example: simple line plots with NaNs inserted.
"""
from pylab import *
+import numpy as np
t = arange(0.0, 1.0+0.01, 0.01)
s = cos(2*2*pi*t)
t[41:60] = NaN
+#t[50:60] = np.inf
subplot(2,1,1)
plot(t, s, '-', lw=2)
@@ -20,6 +22,7 @@
t[0] = NaN
t[-1] = NaN
plot(t, s, '-', lw=2)
+title('Also with NaN in first and last point')
xlabel('time (s)')
ylabel('more nans')
Modified: trunk/matplotlib/src/_path.cpp
===================================================================
--- trunk/matplotlib/src/_path.cpp 2008-08-06 17:42:59 UTC (rev 5980)
+++ trunk/matplotlib/src/_path.cpp 2008-08-06 18:06:21 UTC (rev 5981)
@@ -280,6 +280,8 @@
{
if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
continue;
+ if (MPL_notisfinite64(x) || MPL_notisfinite64(y))
+ continue;
if (x < *x0) *x0 = x;
if (y < *y0) *y0 = y;
if (x > *x1) *x1 = x;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|