SCATTERBAR3(X,Y,Z,WIDTH) draws 3-D bars of height Z at locations X and Y with width WIDTH. X, Y and Z must be of equal size. If they are vectors, than bars are placed in the same fashion as the SCATTER3 or PLOT3 functions. If they are matrices, then bars are placed in the same fashion as the SURF and MESH functions. The colors of each bar read from the figure's colormap according to the bar's height.
Manu R (2020). SCATTERBAR3 (https://www.mathworks.com/matlabcentral/fileexchange/1420-scatterbar3), MATLAB Central File Exchange. Retrieved .
For MATLAB R2019b add view(-45,45) or view(-45,30) after scatterbar3 command to fix viewing angle issue.
Has anyone verified it works with R2019b? I am having problems on getting 3D results. It returns a 2D plane of the input with color reference to the height but no 3D bars.
Answering to Ramis' comment, I guess that when the difference between "r" and "c" in "size(C)" is large, the bars will have a very "rectangular" base rather then squared. A simple solution would be to add "pbaspect([c r 1])" right after "caxis([min(Z(:)) max(Z(:))])"
What would you recommend is the best way to change the thickness in the y direction?
Never mind I got it, it works great. thank you!!!
Super useful and works fine, still wondering why this is not implemented in MATLAB's bar3 function. Some more functionality can be still added, though.
This is great. Thank you. I agree with Ali's comment from back in 2016. Having the ability to set the x and y widths independently would be good. I am not plotting normalized data, so the widths look bad for one of the axes. Even better would be to have the bars fill the available space between bars based on a scaling factor, similar to how bar3 does it (0 to 1). This would account for the different units, as well as non-uniformly sized bars/bins.
This is so good to use!
awesome submission. thanks!
one improvement suggestion: I think being able to set widths in x and y directions independently would be very useful. Not all data is normalized in x- and y-dir
there seems to be a problem when you set the width to 0.11. its ok if width 1. The axis dont seem to sit on top of each other tightly. there is a small gap in between the axis grids.
Easy to use and very flexable to use!
Exactly what i was looking for!
I suggest to set the 'renderer' to 'zbuffer' to improve figure editing readiness.
Exactly what I needed, thanks a lot!
Great! Very usefull, thanks!
Perfect match to what I needed.
It will help me a lot in the presentation of some of my plots. Tnks...
Worked very well for my problem!
Did not work after rescaling the plot with nonzero lower limit of z-axis, e.g. axis([3 8 5 9 2 10]). So I kept the lower limit of the z-axis at zero.
A simple 3D column chart was produced after enetering the x,y,z data, excel can be used but useful if the rest of your report is in matlab. Thanks
Easy to tweak & does 3-D bar charts well
Works very well
Was exactly what I needed on short notice.
Works well after some tweaking to get the correct input.