Quiver always come on top !!!!

3 次查看(过去 30 天)
Coastal_Eng
Coastal_Eng 2014-1-17
回答: AJ von Alt 2014-1-21
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

回答(1 个)

AJ von Alt
AJ von Alt 2014-1-21
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:

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by