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