Use image function to create heat map and 3D plot?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have 4 variables (X, Y, Z, W) I am trying to plot at the same time. I already have code set up to plot a heat map showing population count over a range of X and Y values. These population values are found in variable Z. However, now I am trying to make a 3D heat map using the image function to add in height values, found in variable W. How would I go about doing this? I want the heat map and colorbar to show the range of values for population count, not height. The z axis can just show the height values. I am able to use surfc to plot X,Y,W as seen below too, but I don't know how to combine the two plots. The four variables are attached as .mat files.
traj_xmin = 0; % traj plot axis limits
traj_xmax = 3200;
traj_ymin = 0;
traj_ymax = 1400;
figure(1)
im = image('XData', [traj_xmin traj_xmax], 'YData', [traj_ymin traj_ymax], 'CData', Z, 'CDataMapping', 'scaled');
colormap(flipud(pink));
colorbar
AxesH = gca;
axis(AxesH, 'tight');
figure(2)
rotate3d
surfc(X,Y,W);
colorbar
AxesH = gca;
axis(AxesH, 'tight');
zlim([0 200]);
0 Kommentare
Antworten (1)
Arun Mathamkode
am 1 Feb. 2018
You can use the cdata property in the surface properties to assign vertex colors on a surface.
figure,surf(X,Y,Z,'cdata',W);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!