## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", warning = FALSE, message = FALSE, fig.width = 7, fig.height = 7, fig.align = "center", dpi = 120 ) ## ----------------------------------------------------------------------------- library(ggtaichi) library(ggplot2) ## ----fig.width = 4.5, fig.height = 4.5---------------------------------------- one <- data.frame(x = 1, y = 1, google = 7, twitter = 3) ggplot(one, aes(x, y)) + geom_taichi(yin = twitter, yang = google) + coord_fixed() + theme_taichi() ## ----------------------------------------------------------------------------- head(pitts_tg) ## ----fig.height = 6----------------------------------------------------------- ggplot(pitts_tg, aes(x = week, y = category)) + geom_taichi(yin = Twitter, yang = Google) + theme_taichi() + ggtitle("Pittsburgh Google & Twitter Incidence Rate (%)") ## ----fig.height = 8----------------------------------------------------------- pitts_small <- subset(pitts_tg, week <= 6) ggplot(pitts_small, aes(x = week, y = category)) + geom_taichi(yin = Twitter, yang = Google) + theme_taichi() + ggtitle("The first six weeks, drawn large") ## ----fig.height = 8----------------------------------------------------------- ggplot(pitts_small, aes(x = week, y = category)) + geom_taichi( yin = Twitter, yin_name = "Twitter (%)", yin_colors = c("#deebf7", "#3182bd", "#08306b"), yang = Google, yang_name = "Google (%)", yang_colors = c("#fee6ce", "#e6550d", "#7f2704") ) + theme_taichi() ## ----fig.height = 8----------------------------------------------------------- ggplot(pitts_small, aes(x = week, y = category)) + geom_taichi(yin = Twitter, yang = Google) + remove_padding(x = "c", y = "d") + theme_taichi() ## ----fig.height = 8----------------------------------------------------------- two_states <- subset(states_tg, state %in% c("New York", "Texas") & week <= 6) ggplot(two_states, aes(x = week, y = category)) + geom_taichi(yin = Twitter, yang = Google) + facet_wrap(~ state, ncol = 1) + remove_padding(x = "c", y = "d") + theme_taichi() + ggtitle("New York vs Texas, weeks 1-6") ## ----fig.height = 6----------------------------------------------------------- ggplot(pitts_small, aes(x = week, y = category)) + geom_taichi(yin = Twitter, yang = Google) + theme_taichi() + theme(plot.background = element_rect(fill = "white")) + ggtitle("theme_taichi(), then tweaked")