Is there any plot function that perform a plan view of bar3?
2 次查看(过去 30 天)
显示 更早的评论
if we have a square matrix H=randi(N,N)+1i*randi(N,N); I want to see the plan view of bar3(abs(H)), especially, for the same amplitude of entries in H, I want them have the same color. By the way, I don't think pcolor will work because pcolor plot the abs(H) at grid point instead of square area.
0 个评论
回答(1 个)
DGM
2023-2-25
This sounds like a use for imagesc(). While surf()/pcolor() associate the data values with the vertices, image()/imagesc() associate the data with the face centers.
N = 5;
H = magic(5)
% a bar3 plot with bar colors matching z-height
hb = bar3(abs(H));
for k = 1:numel(hb)
c = permute(reshape(hb(k).ZData,6,5,4),[1 3 2]);
c = permute(repmat(max(c,[],[1 2]),[6 4 1]),[1 3 2]);
hb(k).CData(:) = reshape(c,[],4);
end
% using imagesc() instead
figure
imagesc(H)
Of course, if you want the gaps between the faces, that might be a different story.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!