Quiver always come on top !!!!

5 ビュー (過去 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 Center および File ExchangeVector Fields についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by