3D bar plot, does not show solid bars

4 次查看(过去 30 天)
Yugal
Yugal 2025-4-29
评论: Yugal 2025-4-30
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))

回答(2 个)

Thorsten
Thorsten 2025-4-29
Try
bar3(log(errdata(:,:,2)))
  2 个评论
Yugal
Yugal 2025-4-29
Thanks! @Thorsten
But still theres a problem
all the bars does not start from same level in z-axis, so not easy to compare
Yugal
Yugal 2025-4-29
I got a solution
figure;
bar3(log10(err_Cs(:,:,2))-5)
% set(gca,'ZScale', 'log');
I shifted the positve bars to negative side by subtracting all the bars z data by 5 units.

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2025-4-29
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 个评论
Yugal
Yugal 2025-4-30
@Walter Roberson that negative comes after taking the log of actual error (e.g. log10(0.1) = -1, like that)
The data itself doesnt have any negative values.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by