MATLAB Answers

3dBar with log scale

1 view (last 30 days)
Boyoung Han
Boyoung Han on 16 Feb 2021
Answered: Jemima Pulipati on 18 Feb 2021
A = {65.82 94.96 114.63 144.24 199.28 267.01 287.34
74.34 307.17 634.22 1481.52 3241.10 6420.38 7898.15
213.06 932.81 1759.78 4190.30 8669.17 17170.48 21056.44
300.07 491.60 637.27 951.84 1240.15 1692.68 1895.82
75.39 325.44 2166.83 5234.58 10729.54 21615.95 26755.74
226.87 1052.09 2037.90 5063.59 9838.12 20093.12 24679.11
1558.58 2598.05 3246.95 4707.68 6446.72 8663.72 9684.85
1230.31 5863.62 11958.76 29224.56 60005.76 120837.72 152369.32
248.60 1032.16 2084.52 5011.03 10142.33 19931.25 25686.99}
AA = cell2mat(A)
[r, c] = size(AA);
Y = [1 2 3 5 6 7 9 10 11];
width = 0.5
hBar = bar3(Y, AA, width);
set(gca, 'YTickLabel', {'e' 'm' 'd'});
set(gca, 'XTickLabel', {'20K', '100K', '200K', '500K', '1M','2M','2.5M'});
view(-70, 30);
text(-2, 2, 'Small');
text(-2, 6, 'Medium');
text(-2, 10, 'Large');
I wrote code like above and get bar3 like below.
But if I add
set(gca, 'ZScale', 'log');
code to make z axis as log scale, the graph change like below
graph is not bar chart and text('Small, Medium, Large') dissapears.
Would you help me please,,
and is there any way to display each values of each bar above the bar?
Thanks

Community Treasure Hunt

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

Start Hunting!

Translated by