View source: R/prettybarplot.R
prettybarplot | R Documentation |
draws a barplot of a one or two dimensional frequency table with frequencies on top of bars and pretty background
prettybarplot(
x,
col = "standard",
ylab = "",
xlab = "",
main = "",
names = "",
ylim = c(0, max(x) + max(x)/7),
box = TRUE,
space = 0.2,
border = "black",
text = TRUE,
cex = 1,
coltext = 1,
pre = "n = ",
post = "%",
digit = 1,
legend = TRUE,
bg = TRUE,
bg.increase = TRUE,
bg.from = "grey",
bg.to = "white",
axes = TRUE,
cex.axis = par("cex.axis"),
cex.names = par("cex.axis")
)
x |
a one or two dimensional frequency table |
col |
color of bars |
ylab |
y axis label |
xlab |
y axis label |
main |
title |
names |
name of bars/bar groups (in 2 dimensional table) |
ylim |
y-axis limits |
box |
draw box around plot |
space |
space between bars |
border |
border color of bars |
text |
draw text on bars |
cex |
text size |
coltext |
color of text on bars |
pre |
pre text for absolute frequencies |
post |
post text for relative frequencies |
digit |
digits to draw percentual frequencies with |
legend |
Logical. If TRUE draws legend |
bg |
draw background |
bg.increase |
top-down increase/decrease in background color |
bg.from |
background starting color |
bg.to |
background end color |
axes |
draw axes |
cex.axis |
size of bar labels |
cex.names |
size of axis labels |
x<-sample(paste("group",1:5),2000,T)
y<-sample(c("car","bike","bus"),2000,T)
# one dimensional barplot
prettybarplot(prop.table(table(x)))
# two dimensional barplot
prettybarplot(prop.table(table(y,x),m=2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.