How to change distance of xticks in 3d bar plot (using bar3) ?

9 次查看(过去 30 天)
Hi, I'm trying to draw multiple 3d bar plots in a single figure.
I used 'bar3', as below, but the result is quite unsatisfying.
july_mean = 20 + (50-20).*rand(24,1);
june_mean = 20 + (50-20).*rand(24,1);
may_mean = 20 + (50-20).*rand(24,1);
dat = [may_mean,june_mean,july_mean];
figure; h=bar3(dat);
I want to widen the distance between xticks 1,2,3 so that 3 barplots seem well saparated.
How can I do that?

采纳的回答

Voss
Voss 2022-5-29
july_mean = 20 + (50-20).*rand(24,1);
june_mean = 20 + (50-20).*rand(24,1);
may_mean = 20 + (50-20).*rand(24,1);
dat = [may_mean,june_mean,july_mean];
How about this?
figure;
h=bar3(dat);
axis square
Or this?
figure;
h=bar3(dat);
pbar = get(gca(),'PlotBoxAspectRatio')
pbar = 1×3
2.8000 25.0000 15.4508
pbar(1) = 10;
set(gca(),'PlotBoxAspectRatio',pbar)
Or maybe this?
figure;
h=bar3(dat,0.4); % bar width = 0.4
set(gca(),'PlotBoxAspectRatio',pbar)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by