This is a demo of ggplot2. Install ggplot2 from RStudio Tools.

Line Chart

library(ggplot2)
library(plyr)
p = qplot(wt, mpg, data = mtcars)
p + geom_abline() + xlab('Weight') + ylab('Miles per Gallon')

coef(lm(mpg ~ wt, data = mtcars))
## (Intercept)          wt 
##   37.285126   -5.344472
p + geom_abline(intercept = 37, slope = -5)

p + geom_smooth(aes(group=cyl), method="lm")

p + geom_abline(intercept = 37, slope = -5) + coord_polar()

Bar Chart

c = ggplot(mtcars, aes(factor(cyl)))
c + geom_bar()

c + geom_bar() + coord_flip()

qplot(factor(cyl), data=mtcars, geom="bar", fill=factor(cyl))

qplot(factor(cyl), data=mtcars, geom="bar", fill=factor(gear))

ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar()

k = ggplot(mpg, aes(manufacturer, fill=class))
k + geom_bar()

k + geom_bar() + scale_fill_brewer()

Box Plot

p = ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_boxplot(aes(fill = factor(cyl)))

Dot Plot

ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) +
  geom_dotplot(stackgroups = TRUE, binwidth = 1, binpositions = "all")

Error Bars

df = data.frame(
  trt = factor(c(1, 1, 2, 2)),
  resp = c(1, 5, 3, 4),
  group = factor(c(1, 2, 1, 2)),
  se = c(0.1, 0.3, 0.3, 0.2)
)
limits <- aes(ymax = resp + se, ymin=resp - se)
p = ggplot(df, aes(colour=group, y=resp, x=trt))
p + geom_point() + geom_errorbar(limits, width=0.2)

Jitter Plot

qplot(class, hwy, data = mpg, geom = c("jitter", "boxplot")) +
   theme(axis.text.x = element_text(angle = 90, hjust = 1))

Violin Plot

p = ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_violin(aes(fill = factor(cyl)))

Facet Grid

p = qplot(Sepal.Length, Petal.Length, data=iris, color=Species)
p + facet_grid(~Species) + theme(legend.position='top')

References