Description Usage Arguments Value Author(s) Examples
Function to create a simple barplot
1 2 3 4 5 |
freq |
vector with the bar heights, e.g. a frequency table ('table()' output), names will be used for bar labels if 'labels' is not specified |
labels |
bar labels (default=NULL) |
labels.ab |
additional labels, which are placed above the bars (default=NULL) |
file.name |
name for the PNG output file (without '.png' ending) |
col |
color for the bars (default='tomato3'). if more than one color is specified, |
cex.lab |
size of the bar labels (default=1) |
cex.lab.ab |
size of the bar labels above the bars (default=1) |
cex.x |
size of the x-labels (default=1) |
xlab |
label for the x-axis (default=”) |
ylab |
label for the y-axis (default='Frequency') |
add.legend |
TRUE/FALSE should a legend be added underneath the plot only works if legend parameters are specified (default=TRUE) |
leg.lab |
labels for the legend (default=NULL) |
leg.col |
colors for the legend (default=NULL) |
leg.title |
title for the legend (default=NULL) |
mar |
plot margin (default=c(5,4,3,1)) |
png.width |
width of the PNG-file in inches (default=6) |
png.height |
height of the PNG-file in inches (default=5) |
PNG file with the barplot ('file.name.png') and a numeric vector with size of the PNG-file in inches for rescaling in RTF
Sebastian Voss, Adam Skubala
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
set.seed(42)
x <- sample(1:30, size=500, replace=TRUE)
freq <- table(x)
general.bar_plot_simple(freq, labels.ab=1:30, file.name="test",
col=rep(c('tomato3','tomato3','skyblue2'), 10),
cex.lab=.7, cex.lab.ab=.8, cex.x=.9,
ylab="Bar Height",
add.legend=TRUE, leg.title="Color",
leg.lab=c('red','blue'), leg.col=c('tomato3','skyblue2'),
mar=c(4,4,3,1))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.