Skip to Main Content Skip to Search
Product Documentation

plot::Bars3d3D bar chart of matrix data

plot::Bars3d(A) generates a 3D bar chart with bar heights given by the entries of the matrix A.

→ Examples

Calls:

plot::Bars3d(A, <x = `x_{min}` .. `x_{max}`, y = `y_{min}` .. `y_{max}`>, <a = amin .. amax>, Options)

plot::Bars3d(L, <x = `x_{min}` .. `x_{max}`, y = `y_{min}` .. `y_{max}`>, <a = amin .. amax>, Options)

Parameters:

A

an array of domain type DOM_ARRAY or a matrix of category Cat::Matrix (e.g., of type matrix or densematrix) containing real numerical values or expressions of the animation parameter a. Rows/columns of the array, respectively matrix, correspond to rows/columns of the bar chart. 
A is equivalent to the attribute Data.

L

a list of lists of real numerical values or expressions of the animation parameter a. Each sublist of L represents a row of the bar chart. 
L is equivalent to the attribute Data.

x

name of the horizontal variable: an identifier or an indexed identifier. It is used as the title of the coordinate axis in x direction. 
x is equivalent to the attribute XName.

`x_{min}` .. `x_{max}`

the range of the horizontal variable: `x_{min}`, `x_{max}` must be numerical real value or expressions of the animation parameter a
`x_{min}` .. `x_{max}` is equivalent to the attribute XRange.

y

name of the vertical variable: an identifier or an indexed identifier. It is used as the title of the coordinate axis in y direction. 
y is equivalent to the attribute YName.

`y_{min}` .. `y_{max}`

the range of the vertical variable: `y_{min}`, `y_{max}` must be numerical real value or expressions of the animation parameter a
`y_{min}` .. `y_{max}` is equivalent to the attribute YRange.

Related Domains:

plot::Bars2d, plot::Histogram2d, plot::Matrixplot

Related Functions:

plot, plot::copy

Details:

Example 1

We create some random matrix data and plot them as a bar chart:

A := matrix::random(5, 10, frandom) :
plot(plot::Bars3d(A, Gap = [0.4, 0.7]))

MuPAD graphics

We create bar charts of the data with different BarStyle options:

plot(plot::Scene3d(plot::Bars3d(A, BarStyle = Boxes)),
     plot::Scene3d(plot::Bars3d(A, BarStyle = Lines)),
     plot::Scene3d(plot::Bars3d(A, BarStyle = Points)),
     plot::Scene3d(plot::Bars3d(A, BarStyle = LinesPoints)),
     PointSize = 2.0*unit::mm, LineWidth = 0.5*unit::mm
):

MuPAD graphics

delete A:

Example 2

We demonstrate the positioning of bar charts by specifying ranges for the x and the y coordinate. The following two bar charts are plotted in one scene. They are placed side by side via suitable x ranges:

A := matrix::random(5, 5, frandom):
plot(plot::Bars3d(A, x = 0 .. 0.9, y = 0 .. 1,
                  BarStyle = LinesPoints),
     plot::Bars3d(A, x = 1.1 .. 2, y = 0 .. 1,
                  Gap = [0.3, 0.7])):

MuPAD graphics

delete A:

Example 3

We demonstrate the attributes Ground and Color:

A := matrix::random(5, 10, frandom):
plot(plot::Scene3d(plot::Bars3d(A, Ground = 0,
                                Color = RGB::Grey)),
     plot::Scene3d(plot::Bars3d(A, Ground = 0.5,
                                Color = RGB::Grey)),
     Layout = Horizontal):

MuPAD graphics

In the next call, the ground level is animated. Note that in animations one must specify ranges for the x and y coordinates.We include a transparent plane visualizing the ground level:

plot(plot::Bars3d(A, x = 0 .. 1, y = 0 .. 1, a = 0 .. PI,
                  Color = RGB::Grey, Gap = [0.5, 0.5],
                  Ground = sin(a)),
     plot::Surface([x, y, sin(a) + 0.001],
                   x = 0 .. 1, y = 0 .. 1, a = 0 .. PI,
                   Mesh = [2, 2], Color = RGB::Blue.[0.5])):

MuPAD graphicsimage

delete A:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS