Using GGplot2

Loading ggplot2 with command library:

library(ggplot2)
data(singer, package="lattice")

Make our base layer with ggplot(), arguments, data, and asethetics.

Making the first layer:

gg <- ggplot(singer, aes(x=voice.part, y=height))
gg

gg + geom_boxplot()

data(USArrests)
crimes <- data.frame(state=tolower(rownames(USArrests))
, USArrests)
library(maps)
gg <- ggplot(crimes, aes(map_id=state, fill=Murder))
gg <- gg + geom_map(map=map_data("state"))
gg <- gg + expand_limits(x=map_data("state")$long, y=map_data("state")$lat)
gg

gg + labs(title="Murder rates per 100,000 in 1973", x="longitude", y="latitude")