
Quiver always come on top !!!!
2 views (last 30 days)
Show older comments
Hi guys; a very fast question. I'm plotting some velocity fields (magnitude), and i want to ovelerlapp the velocity vector on top of it. Since i'm dealing with a river, i'm interested on representing the river banks, and in order to produce a nice a smooth image, i want to "cover" the parts of the grid where the quiver is NaN (land). Imagine the situation:
Pcolor(X,Y,VEL)
hold on
patch(bank_x,bank_y,'g')
hold on
quiver(X,Y,U,V)
somehow the quiver is plotted on top of everything !!!! This way i can't hide the NaN with the Cover file (a patch of the bank file).
Does anyone ever encounter this problem??
TKS
Rod
0 Comments
Answers (1)
AJ von Alt
on 21 Jan 2014
You can fiddle with the z values of the patch to change whether it appears on top. Z values larger than 1 will usually make the patch appear in front of quiver and values less than 1 will make the patch appear behind quiver.
Example:
[x,y] = meshgrid(0:0.2:2,0:0.2:2);
u = cos(x).*y;
v = sin(x).*y;
figure
subplot(1,2,1)
patch([0;2;0] , [0;2.5;2.5],[0;0;0],'r')
hold on;
quiver(x,y,u,v)
hold off;
title('Quiver over patch');
subplot(1,2,2)
quiver(x,y,u,v)
hold on;
patch([0;2;0] , [0;2.5;2.5],'r')
hold off;
title('Patch over quiver')
Produces:

0 Comments
See Also
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!