How can I plot a 3D histogram using hist3 with log scale?

9 ビュー (過去 30 日間)
Hugo SP
Hugo SP 2012 年 11 月 20 日
Here is an example code:
x = 1:20;
y = 2*x;
hist3([x' y']);
set(gca,'zscale', 'log');
With the log scale on the Z axis the bars disappear. I think this is because 0 values are mapped to -Inf. I there any workaround for this? I have seen for 2D hist that it is possible to adjust the bar base to 1, but I do not know how to do it for 3D hist.
Thank you.

採用された回答

Matt Fig
Matt Fig 2012 年 11 月 20 日
x = 1:20;
y = 2*x;
hist3([x' y']);
S = findobj('type','surf');
ZD = get(S,'zdata');
ZD(~ZD) = .1;
set(S,'zdata',ZD);
set(gca,'zscale', 'log');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLog Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by