Bar Chart
barplot <- ggplot(Titanic, aes(x=Survived,y=Freq)) +
geom_bar(stat="identity")
print(barplot)

Stacked Bar Chart
barplot <- ggplot(Titanic, aes(x=Survived,y=Freq,fill=Sex)) +
geom_bar(stat="identity")
print(barplot)

Side-by-side Bar Chart
barplot <- ggplot(Titanic, aes(x=Sex,y=Freq,fill=Survived)) +
geom_bar(stat="identity",position=position_dodge())
print(barplot)

Faceted Bar Chart
barplot <- ggplot(Titanic, aes(x=Survived,y=Freq,fill=Sex)) +
geom_bar(stat="identity") +
facet_wrap( ~ Class )
print(barplot)

Dot Plot
dotplot1 <- ggplot(mtcars, aes(x=mpg)) +
geom_dotplot()
print(dotplot1)
## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.

Side-by-Side Dot Plot
dotplot2 <- ggplot(mtcars, aes(x=factor(cyl),y=mpg)) +
geom_dotplot(binaxis='y')
print(dotplot2)
## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.

Histogram
dotplot1 <- ggplot(mtcars, aes(x=mpg)) +
geom_histogram(bins=5)
print(dotplot1)

More Histograms
dotplot2 <- ggplot(mtcars, aes(x=mpg,fill=factor(cyl))) +
geom_histogram(bins=5,alpha=0.5)
print(dotplot2)

Density Plot
densplot1 <- ggplot(mtcars, aes(x=mpg)) +
geom_density()
print(densplot1)

Box Plot
boxplot1 <- ggplot(mtcars, aes(x=factor(cyl),y=mpg)) +
geom_boxplot()
print(boxplot1)
