library(ggplot2)
### Plot #1 ###
# Faceted scatter plot
ggplot(data = diamonds, aes(x=price, y=carat)) +
geom_point(aes(col = clarity), size = 1) +
facet_grid(~color) +
ggtitle("Diamond Price x Carat") +
xlab("Price") +
ylab("Carat")

### Plot #2 ###
# Colored histogram
ggplot(diamonds, aes(x=price, fill=clarity)) +
geom_histogram() +
ggtitle("Histogram of Prices by Clarity")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

### Plot #3 ###
# Flipped plot
ggplot(data = diamonds, aes(x=cut, y = price, fill = cut)) +
geom_bar(width = 1, stat = "identity") +
ggtitle("Diamond Cut ~ Price") +
coord_flip()
