I would like to plot several histograms in 3D using Matlab like in the below figure. Does anyone have any suggestions?
I use bar3 and histogram2, but both of them are not appropriate with the problem that I want.
You can get what you want with multiple calls to histogram2
, one for each x value.
xs = 10:10:100;
ys = normrnd(50,20,numel(xs),5000);
colors = jet(numel(xs));
for i = 1:numel(xs)
histogram2(repmat(xs(i),1,size(ys,2)),ys(i,:),'FaceColor',colors(i,:))
hold on
end
hold off