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

10 vues (au cours des 30 derniers jours)
aposta95
aposta95 le 29 Mai 2022
Réponse apportée : Voss le 29 Mai 2022
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?

Réponse acceptée

Voss
Voss le 29 Mai 2022
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)

Plus de réponses (0)

Catégories

En savoir plus sur Discrete Data Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by