stackedBarplot | R Documentation |
This produces a series of stacked bar plots staggered so that the baseline corresponds to a particular state level. This is primarily designed for producing plots of probability vectors coming out of Bayes net scoring.
stackedBarplot(height, width = 1, space = 0.2, offset = 0, names.arg = NULL,
legend.text = NULL, horiz = FALSE, density = NULL,
angle = 45, col = NULL, border = par("fg"),
main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
xlim = NULL, ylim = NULL, xpd = TRUE, axis = TRUE,
axisnames = TRUE, cex.axis = par("cex.axis"),
cex.names = par("cex.axis"), newplot = TRUE,
axis.lty = 0, ...)
height |
A matrix giving the heights of the bars. The columns represent bars, and the rows represent groups within each bar. |
width |
A numeric vector of length equal to the number of columns
in |
space |
A numeric vector of length equal to the number of columns
in |
offset |
A numeric vector of length equal to the number of
columns in |
names.arg |
If not missing, used as axis labels (see
|
legend.text |
If node null, a legend is generated (see
|
horiz |
A logical value. If true, stacked bars are printed horizontally instead of vertically. |
density |
Density of shading lines (see
|
angle |
Angle of shading lines (see
|
col |
Color used for each bar. This should be a scalar or a vector
of length equal to the number of rows of |
border |
Color for the rectangle borders (see
|
main |
Main title for plot (see |
sub |
Subtitle for plot (see |
xlab |
X-axis label for plot (see |
ylab |
Y-axis label for plot (see |
xlim |
Limits in user co-ordinates for the x-axis. Should be a vector of length 2. |
ylim |
Limits in user co-ordinates for the y-axis. Should be a vector of length 2. |
xpd |
A logical value controlling clipping. (see
|
axis |
A logical value. If true, a numeric scale is printed on the appropriate axis. |
axisnames |
A logical value. If true, column names are printed on the appropriate axis. |
cex.axis |
Character size used for the numeric axis labels (see
|
cex.names |
Character size used for the text (column names) axis
labels (see |
newplot |
A logical value. If true a new graphics region is created. If false, the plot is placed on top of the existing graphics region. |
axis.lty |
A value passed as the |
... |
Other graphics parameters passed to
|
This is a more detailed version of the stackedBars
graph which allows finer control. It is used mainly by
compareBars
.
There are some differences from stackedBars
. First,
height
can be any value, not just a vector of probability.
Second, offset
is given as a numeric value in the units of
height, rather than as an index into the array of heights. Most of
the rest of the arguments merely expose the graphical arguments to the
user.
The midpoints of the bars are returned invisibly.
Russell Almond
compareBars
, colorspread
,
buildMarginTab
, marginTab
,
barplot
,stackedBars
margins <- data.frame (
Trouble=c(Novice=.19,Semester1=.24,Semester2=.28,Semseter3=.20,Semester4=.09),
NDK=c(Novice=.01,Semester1=.09,Semester2=.35,Semseter3=.41,Semester4=.14),
Model=c(Novice=.19,Semester1=.28,Semester2=.31,Semseter3=.18,Semester4=.04)
)
margins <- as.matrix(margins)
baseline <- apply(margins[1:2,],2,sum)
stackedBarplot(margins,offset=-baseline,
main="Marginal Distributions for NetPASS skills",
sub="Baseline at 2nd Semester level.",
col=hsv(223/360,.2,0.10*(5:1)+.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.