Vector plot over a surface plot

12 visualizaciones (últimos 30 días)
Abdul Mannan
Abdul Mannan el 19 de Feb. de 2020
Comentada: Abdul Mannan el 19 de Feb. de 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)

Respuesta aceptada

KSSV
KSSV el 19 de Feb. de 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.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by