From: D. S. M. <ds...@gm...> - 2012-03-11 22:27:39
|
Hi! Bumping this upstream from Sage, where we use quiver to draw slope fields. The following code ### import matplotlib.pyplot as plt import numpy as np fig = plt.figure() r = np.arange(10) X,Y = np.meshgrid(r,r) U, V = np.cos(X), np.sin(Y) Q = plt.quiver( U, V, headlength=0, headaxislength=0) ### produces exactly what we want, but generates some warnings: /usr/local/lib/python2.7/dist-packages/matplotlib/quiver.py:622: RuntimeWarning: divide by zero encountered in divide shrink = length/minsh /usr/local/lib/python2.7/dist-packages/matplotlib/quiver.py:623: RuntimeWarning: invalid value encountered in multiply X0 = shrink * X0[np.newaxis,:] /usr/local/lib/python2.7/dist-packages/matplotlib/quiver.py:624: RuntimeWarning: invalid value encountered in multiply Y0 = shrink * Y0[np.newaxis,:] We can get around this by using some tiny headlength (minsh = self.minshaft * self.headlength) but it seems more natural to avoid drawing one entirely. Would there be any objections to a pull request which special-cased 0 to avoid this? Doug |