Plotting grouped 3D bars from 3D matrix
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear Matlab Community,
I have a 3D matrix (rows=5, cols=4, planes=5) where rows represent different simulation conditions (1 to 5 values on the x-axis), columns represent different simulation approaches (4 colors in the attached plots) and planes represent different parameterization (δ in the attached plot). I created the attached plot using tiled layout where I loop over the 3rd index of the matrix and plot the corresponding 2D matrix using grouped bar3 plot, but I want to merge them all in one 3D bar plot where I want each color to represent a column and combine the variation in δ into the y-axis.
Thanks in advance for your help!
0 Commenti
Risposta accettata
Matt J
il 11 Giu 2023
Modificato: Matt J
il 11 Giu 2023
Perhaps as follows:
z=rand(5,4,5);%Fake data
numDelta=size(z,3);
clear xtk
for i=1:numDelta
h=bar3(z(:,:,i),'grouped'); hold on
for j=1:numel(h)
h(j).XData=h(j).XData+(i-1);
end
xtk(i)=mean([h.XData],'all','omitnan');
end
hold off; axis padded, axis equal
zlabel z, ylabel y, xlabel('\delta')
xticks(xtk); xticklabels(string((1:numDelta)*0.05));
view(25,30)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!