Vector plot over a surface plot

7 次查看(过去 30 天)
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.

更多回答(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