3
votes

I am trying to recreate a 3d quiver plot that was made in Matlab using quiver3. The data is exactly the same, however when plotted the arrows seem to point to 0 with no arrow head and the x and y axis appear to be switched (as you have to reverse the x axis in python rather than y in matlab to get the same axis values. Does anyone know why this may be happening?

The matlab code is:

quiver3(zeros(size(binrange)), zeros(size(binrange)), binrange, v,u, zeros(size(v)),0);
set(gca,'YDir','reverse'); 

The matlab plot is:

enter image description here

The python code is:

ax.quiver3D(np.zeros(len(binrange)), np.zeros(len(binrange)), binrange, aa, bb, np.zeros(len(bb)), length=0.1, color='tomato')
 plt.gca().invert_xaxis()

The python plot is:

enter image description here

1
I would say that those red lines are inverted. they go to the negative of the axes, not positive. I'd say the arrow is there, but its close to 0,0 so you dont see it. Fix it and update the postAnder Biguri
change the pivot. From the docs: "pivot: [ ‘tail’ | ‘middle’ | ‘tip’ ] The part of the arrow that is at the grid point; the arrow rotates about this point, hence the name pivot." I would guess you have tip set (possibly the default value?), and you want tail.tmdavison
It seems that this question is no longer active. I'm not sure if the comment from @tom was helpful to the OP, but it seems so. Tom, maybe you could provide it as a real answer, such that it no longer appears in the unanswered list?tvo

1 Answers

0
votes

change the pivot. From the docs: "pivot: [ ‘tail’ | ‘middle’ | ‘tip’ ] The part of the arrow that is at the grid point; the arrow rotates about this point, hence the name pivot." I would guess you have tip set (possibly the default value?), and you want tail.