Turning 4 metric coordinates of Vector into a Vector field
<p>I have four 3*3 matrices:</p>

<pre><code>X1=[[2.276840271621883, 2.329662596474333, 2.3633290819729527], [2.276840271621883, 2.329662596474333, 2.3633290819729527], [2.276840271621883, 2.329662596474333, 2.3633290819729527]]
X2=[[2.2698145746531786, 2.3308266405107805, 2.3594316100497643], [2.2698145746531786, 2.3308266405107805, 2.3594316100497643], [2.2698145746531786, 2.3308266405107805, 2.3594316100497643]]
Y1=[[48.832151066337865, 48.84935494957576, 48.86990145209316], [48.832151066337865, 48.84935494957576, 48.86990145209316], [48.832151066337865, 48.84935494957576, 48.86990145209316]]
Y2=[[48.83251302946139, 48.85024866127781, 48.86928223168673], [48.83251302946139, 48.85024866127781, 48.86928223168673], [48.83251302946139, 48.85024866127781, 48.86928223168673]]
</code></pre>

<p>I would like to create a vector field containing 9 vectors going from</p>

<pre><code>(X1[i][j],Y1[i][j]) to (X2[i][j],Y2[i][j])
these are coordinates
</code></pre>

<p>I have tried using quiver, but I have a dimension problem.</p>

<p>When you want to plot a set of arrows using matplotlib's <code>quiver</code> function, that start at points <code>Pi = (X1i, Y1i)</code> and "end" at points <code>Qi = (X2i, Y2i)</code>, you call <code>quiver</code> like this:</p>

<pre><code># creating demo data
X1, X2, Y1, Y2 = [ np.random.random_integers(0, 9, (2,2)) for _ in range(4) ] 
plt.quiver(X1, Y1, (X2 - X1), (Y2 - Y1), angles='xy', scale=1, scale_units='xy')
</code></pre>

<p>Notice the added arguments in the call to <code>quiver</code>. These ensure that the arrows start and end in the provided data coordinates.
The shape for <code>X1</code> and the other 3 variables defined here is <code>(2, 2)</code>, which was done only to illustrate that <code>quiver</code> can work with 2-D arrays. You could make the shape <code>(3, 3)</code> to suit your example.</p>

<p>For visualisation purposes and to make the point more clear, I've added some markers to the start and end coordinates:</p>

<pre><code>plt.plot(X1.ravel(), Y1.ravel(), 'ro ')
plt.plot(X2.ravel(), Y2.ravel(), 'bx ')
</code></pre>

<p>which results in this figure:</p>

<p><a href="http://i.stack.imgur.com/KtDuh.png" rel="nofollow"><img src="http://i.stack.imgur.com/KtDuh.png" alt="quiver arrows from begin to end coordinates"></a></p>

python matplotlib arrow