Description Usage Arguments Details Value Author(s) Examples
Function called by other bar plot functions to actually create the bar plot. This allows for a consistent look throughout multiple different functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
table |
table or matrix used for plotting bar graph |
pBeside |
(barplot)(logical) Stacked or side-by-side bars |
pHoriz |
(barplot)(logical) Horizontal or vertical bars |
lined |
(logical) Lined or solid colored bars |
axLim |
(vector) Min and max axis values; x-axis for pHoriz=TRUE, y-axis for pHoriz=FALSE |
yLab |
(barplot)(string) Y-axis label |
xLab |
(barplot)(string) X-axis label |
printBarVals |
(logical) If TRUE the value of each bar is printed above each bar |
Legend |
(logical) If TRUE a legend is printed |
LegendLoc |
(legend) Coordinates of string location of printed legend if Legend=TRUE. See ?legend |
LegendCex |
(legend)(numeric) Sizing ratio of printed legend if Legend=TRUE |
mgp.y |
(par)(vector) Y-axis margin lines for title, label, and line |
mgp.x |
(par)(vector) X-axis margin lines for title, label, and line |
cex.names |
(barplot)(numeric) Sizing ratio of bar names |
barNamesLas |
(0,1,2,or 3). Changes the verticality of the treatment names for bar names and numeric axis. 1 and 2 are best for reporting |
barNamesSeq |
(interger) Number indicating which bar labels to print. This number is given as the 'by' attribute to seq(). So every barNameSeq would be printed. Default is 1, which will print all bar labels. Helpful when bar labels overlap when printing all of them. |
barNamesAngle |
(integer) Number between 0 and 360 indicating how the margin names should be rotated. Useful when margin names are long strings so you can angle them to all be seen |
digits |
(rounds)(numeric) Number of decimal places to round to |
Additional Functions Required: rounds()
This function is an adaptation of the traditional barplot() in which axes, bars, bar values, and legends have the ability to be formatted in multiple different ways.
uwBar is called by any biostatrpts function that creates bar plots.
Returns a list of (1) a matrix of the locations of each bar, (2) the data used to create the bar plot, and (3) the axis values
These values are used in the other biostatrpt functions for other items that are printed like p-values.
University of Wisconsin-Madison Biostatistics and Medical Informatics Department, Scott Hetzel M.S.
1 2 3 4 5 6 7 8 9 10 | mat <- matrix(1:12, nrow = 3)
dimnames(mat) <- list(c("A", "B", "C"), c("D", "E", "F", "G"))
uwBar(mat,
pBeside = TRUE, pHoriz = FALSE, lined = FALSE,
axLim = NULL, yLab = NULL, xLab = NULL, printBarVals = TRUE,
Legend = TRUE, LegendLoc = "topright", LegendCex = 0.8,
mgp.y = c(3, 1, 0), mgp.x = c(3, 1, 0), cex.names = 1, barNamesLas = 1,
barNamesSeq = 1, barNamesAngle = 0, digits = 1
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.