3D bar plot, does not show solid bars
5 views (last 30 days)
Show older comments
i am using bar3 to do the 3D bar plots
when I use log scale for the z axis, only the top face of the 3D bar (say cuboid) shows, the rest of the bar is invisible,
figure;
bar3(err_data(:,:,2))
set(gca,'ZScale', 'log');

this does not happen on removing log scale
figure;
bar3(err_data(:,:,2))

0 Comments
Answers (2)
Walter Roberson
on 29 Apr 2025
You have negative z data. When you set(gca,'ZScale', 'log') then any shape that has a vertex with negative Z cannot be rendered. Remeber that the log() of negative data is pi*1i plus log(-1*data) and renderers cannot handle the imaginary component of the resulting vertices.
3 Comments
Walter Roberson
on 30 Apr 2025
https://www.mathworks.com/matlabcentral/answers/2176730-3d-bar-plot-does-not-show-solid-bars#comment_3332736 clearly shows negative "error"
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!