A student of mine recently noticed that sometimes, quiver plots were 
coming up empty (using the plot_vector_field function from Sage, which 
passes everything on to quiver).  Upon investigation, we saw that some 
of the array entries passed in were infinity because of where we 
happened to evaluate the function.  It was relatively easy to correct in 
our case (change the evaluation to miss the bad point), but is there a 
better way to handle this? Can this be considered a bug in quiver (i.e., 
returning a blank plot when one of the vectors has an infinite coordinate?).

Here is some example code illustrating the problem:


import pylab
import numpy
step=1
X,Y = numpy.meshgrid( numpy.arange(-1,1.1,step),numpy.arange(-1,1.1,step) )
U = 1/X
V = Y
pylab.figure()
Q = pylab.quiver( X,Y,U, V)
pylab.savefig("test.png")

When you change step to something that avoids an evaluation at x=0 (say, 
step=0.13), you get a nice plot.

Is this something that we should be preprocessing in Sage before calling 
quiver, masking those "bad" points or something?  I haven't used masking 
before, but I'd like to fix Sage's plot_vector_field function to return 
something sensible, even when the function happens to be infinite at one 
of the points.

Thanks,

Jason


--
Jason Grout


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to