pcolor-plot move along the z-axis

4 views (last 30 days)
I have the following code.
The problem is, the pcolorplot crosses the surf-plot and I would like to have the pcolorplot by z=-20
It does't work with pcolor(X,Y,Z-20)
[X,Y] = meshgrid(-5:.5:5); %Regelmäßiges Gitter für X und Y
Z = Y.*sin(X) - X.*cos(Y); %Def. für die Z
%% Darstellung mit Surf
figure (1)
surf(X,Y,Z)
title('Z = Y.*sin(X) - X.*cos(Y)') %Titel
xlabel('x [-]') %x-Achsen Beschriftung
ylabel('y [-]')%y-Achsen Beschriftung
zlabel('z [-]')%z-Achsen Beschriftung
xlim([-5 5]) %Begrenzung der Achsen
ylim([-5 5])
zlim([-15 10])
colorbar('AxisLocation','out') %Farbbalken mit Seite der Skala
shading interp %Schattierung
lighting phong %Beleuchtung
colormap hot %Farbgruppe
alpha (0.5) %Durchsichtigkeit
camlight left
material shiny
hold on
%% Darstellung mit mesh
mesh(X,Y,Z) %unnötig, wenn man Faceted Shading (Default)
hold on
%% Darstellung mit pcolor
pcolor(X,Y,Z)
shading interp %Schattierung
hold on

Accepted Answer

Walter Roberson
Walter Roberson on 26 Jan 2020
Edited: Walter Roberson on 26 Jan 2020
Replace
pcolor(X, Y, Z)
With
surf(X, Y, -20*ones(size(Z)), Z, 'edgecolor', 'none' )

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!