Content Prev Next Down

Vertical Bar Charts
Syntax sbar(Y)
See Also sbarh , splot , spquit

Create a vertical bar graph. The argument Y must be a numeric column vector or matrix. If Y is a vector SigmaPlot creates a simple bar graph with N bars where N is the number of rows in Y. If Y is a matrix, SigmaPlot creates a grouped or stacked bar graph with M groups, and N bars per group where M is the column dimension of Y and N is the row dimension of Y.

The argument x is a numeric column vector which specifies the X axis indexes at which each bar, or bar group will be placed. The argument barStyle is a character row vector which must be "stacked" or "grouped". If the barStyle argument is specified the column dimension of Y must be greater than 1. If present, the argument errors is a numeric-valued matrix with the same row and column dimensions as Y. Each column of errors specifies the error values that should be plotted for the corresponding column of Y


Bar Charts Without Errors
If SigmaPlot is not running and at the O-Matrix prompt you enter,
   Y = {2., 2.5, 3.25}
SigmaPlot will create the following bar plot sbar sbarh

If you enter
     sbar([Y, Y*1.5, Y*1.75, Y*1.95])
SigmaPlot will create the following additional plot

If you continue the example above by entering
   x = {10, 15, 20}
   sbar([Y, Y*2.5], x)
SigmaPlot will create another plot, and your notebook will look like

If you enter
   myData = [Y, Y*1.5]
   sbar(myData, x, "stacked")
   sbar(myData, x, "grouped")
SigmaPlot will create two bar plots of the variable myData. (The default barStyle is grouped, which does not need to be specified).

Vertical Bar Charts With Error Bars
Simple and grouped bar plots can also be created with error bars. If SigmaPlot is not running, (See the spquit for exiting the current instance of SigmaPlot), and you enter the following at the O-Matrix prompt
   Y = {2., 2.5, 3.25}
   YN = [Y, Y*1.5, Y*2, Y*0.8]
   x = {10, 15, 20}
   sbar(Y, x, {.2, .3, .1})
   sbar(YN, x, rand(rowdim(YN), coldim(YN))*2)
SigmaPlot will create a new notebook with 2 plots that look like