R - Bar Chart
Updated at 2011-09-04 20:47
Here is how to create a bar chart in R.
fill_colors <- c()
for (i in 1:length(patents$Yhteensa)) {
if (patents$Kotimaa[i] > patents$Ulkomaat[i]) {
fill_colors <- c(fill_colors, "#821122")
} else {
fill_colors <- c(fill_colors, "#CCCCCC")
}
}
barplot(
patents$Yhteensa,
col=fill_colors,
names.arg=patents$Vuosi,
xlab="Year",
ylab="Patents",
ylim= c(0,2500),
main="Granted patens in Finland",
sub="by Tommi Laine, source www.stat.fi"
)