File Exchange

image thumbnail

SCATTERBAR3

version 1.0.0.1 (1.94 KB) by Manu R
Creates a 3-D bar chart where bars are placed in user specified X-Y locations.

71 Downloads

Updated 01 Sep 2016

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

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.

Cite As

Manu R (2020). SCATTERBAR3 (https://www.mathworks.com/matlabcentral/fileexchange/1420-scatterbar3), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (31)

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(:))])"

Ramis Rafay

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!!!

AC90

great!

matzewolf

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.

Will Cross

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.

Xiao Wang

This is so good to use!

Ali

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

morningstar

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.

wang

Easy to use and very flexable to use!

Claudio

Exactly what i was looking for!
I suggest to set the 'renderer' to 'zbuffer' to improve figure editing readiness.

Thanks Manu....handy:)

Frank Leone

Exactly what I needed, thanks a lot!

H. S.

Great! Very usefull, thanks!

Adrian Martin

Perfect match to what I needed.
Many thanks.

Gabriele Bulian

It will help me a lot in the presentation of some of my plots. Tnks...

Erik Salomons

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.

David Scraggs

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

Claire Holeton

Easy to tweak & does 3-D bar charts well

Blair Steeves

Works very well

Matt Largent

Was exactly what I needed on short notice.

Bjørn Borg

Works well after some tweaking to get the correct input.

amir aghdasy

Updates

1.0.0.1

Updated license

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux