Vector plot over a surface plot

5 views (last 30 days)
Abdul Mannan
Abdul Mannan on 19 Feb 2020
Commented: Abdul Mannan on 19 Feb 2020
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)

Accepted Answer

KSSV
KSSV on 19 Feb 2020
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!