Bar3D

Version 1.2 (651 KB) by Ze-Zheng Wu
A function to create 3d bar plot with the ability to set X and Y values.
201 Downloads
Updated 13 Dec 2021

View License

BAR3D 3-D bar plot.
BAR3D(X,Y,Z) plots the 3d bars defined by X, Y and Z, where X and Y are m by n matrices which can be generated by meshgrid from vectors, and Z is an m by n by p matrix. If p is greater than 1, p sets of m by n bars are drawn in the same axes, the default arrangement of bars in the same position but from different sets is being grouped along the x axis, and this default behavior can be modified by setting the parameter 'Arrange'.
BAR3D(X,Y,Z,C) additionally specifies the color of bars, where C is of the same size as X or Y.
BAR3D(Z) is similar to BAR3D(X,Y,Z) but uses the column and row indices of the elements in Z as x and y coordinates.
BAR3D(Z,C) additionally specifies the color of bars.
BAR3D(...,'Width',width) sets the value of the width of bars.
BAR3D(...,'Base',base) sets the base value of the plot, where base can be a scalar value or an m by n matrix.
BAR3D(...,'Arrange',arrange) sets the arrangement of bars if Z is a multidimensional matrix. Available options are 'hold', where bars are plot in the same position, 'x', where bars are grouped along x axis, 'y', where bars are grouped along y axis and 'z' where bars are grouped along z axis or, in other words, stacked together.
BAR3D(...,'Gap',gap) sets the gap of bars if the arrangement is 'x' or 'y', where the gap is considered as a ratio, or 'z', where the gap is considered as a numeric value.
BAR3D(...,'PropertyName',PropertyValue,...) sets the value of the specified BAR3D property, apart from 'Width', 'Base', 'Arrange' and 'Gap'. The property names and values are the same as those of SURF.
BAR3D(AX,...) plots into AX instead of GCA.
h = BAR3D returns a handle to a surface plot object or multiple handles to all the surface plot objects.
AXIS, CAXIS, COLORMAP, HOLD, SHADING and VIEW set figure, axes, and surface properties which affect the display of the 3d bars.
Ze-Zheng Wu 10-1-21

Cite As

Ze-Zheng Wu (2024). Bar3D (https://www.mathworks.com/matlabcentral/fileexchange/100119-bar3d), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.2

1. reformat description.

1.1

1. remove matlab.ui.internal.webGraphicsStateManager;
2. fix some typos

1.0