Tutorial by Examples

# load the library library(ggplot2) # create a blank canvas g <- ggplot(data = diamonds) g + geom_bar(aes(x = cut, fill = cut)) + scale_fill_discrete(guide = guide_legend(title = "CUT", keywidth = 2, ...
g + geom_bar(aes(x = cut, fill = color), position = "fill") + guides(fill = guide_legend(title = NULL))
g + geom_bar(mapping = aes(x = cut, fill = clarity), position = "dodge") + theme(axis.text = element_text(colour = "red", size = 12))
g + geom_histogram(aes(price, fill = cut), binwidth = 500) + labs(x = "Price", y = "Number of diamonds", title = "Distribution of prices \n across Cuts") + theme(plot.title = element_text(colour = "red", face = "italic"), ...

Page 1 of 1