Vector plot over a surface plot

조회 수: 7 (최근 30일)
Abdul Mannan
Abdul Mannan 2020년 2월 19일
댓글: Abdul Mannan 2020년 2월 19일
Dear experts,
How can I get a surface plot like below in which vectors will be shown on the surface plot.
Figure(1)
I have tried this way:
TT = hypot(qx, qy);
figure()
surf(x, y, TT);
xlim([-7 7]);
ylim([-5 5])
colormap jet
colorbar
view(2)
hold on
quiver(x1, y1, qx, qy, 'g'); % plot tangential traction over slip aera
xlabel('X-coordiante [mm]');
ylabel('Y-coordiante [mm]');
zlabel('MPa');
hold off
where, x and y are the coordinates in the X and Y direction and TT is a matrix. qx and qy are the x and y components of TT.
If I plot separately, I get the surface plot and vector plot as shown below figure 2 and 3. But if I plot in the same figure I don’t get a plot like figure 1, rather what I get same as below figure 2. I need expert’s help. Thanks.
Figure(2)
Figure (3)

채택된 답변

KSSV
KSSV 2020년 2월 19일
TT = hypot(qx, qy);
figure()
pcolor(x, y, TT);
xlim([-7 7]);
ylim([-5 5])
colormap jet
colorbar
view(2)
hold on
quiver(x1, y1, qx, qy, 'g'); % plot tangential traction over slip aera
xlabel('X-coordiante [mm]');
ylabel('Y-coordiante [mm]');
zlabel('MPa');
hold off
Don't use surf. It is a 3D plot, when you use quiver the arrows will be plotted under the surf and you cannot see them. Use pcolor.
  댓글 수: 1
Abdul Mannan
Abdul Mannan 2020년 2월 19일
It works. Thank you KSSV.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by