knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library("ggplot2") library("CrimeDLM.RPackage")
ggplot(chicago, aes(month, count, color = type, linetype = type, group = type)) + geom_line() + facet_wrap(~year) + scale_y_sqrt() + theme_bw() + theme(axis.text.x = element_text(angle = 90, hjust = 1), legend.position = "bottom")
ggplot(chicago, aes(month, count, color = year, group = year)) + geom_line() + facet_wrap(~type) + scale_y_sqrt() + theme_bw() + theme(axis.text.x = element_text(angle = 90, hjust = 1))
chicago$date <- as.Date(paste(chicago$year, chicago$month, 15, sep = "-"), format = "%Y-%b-%d") ggplot(data = chicago) + geom_line(mapping = aes(x = date, y = count, colour = type), size = 1.3) + ylab("Crime count") + xlab("Date") + scale_x_date(labels = date_format("%b"), date_breaks = "1 year", date_labels = "%b-%Y") + theme(axis.text.x = element_text(angle = 45, hjust = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.