From daf07fcf9ac9471323cf64029ee7bde2c03a53c8 Mon Sep 17 00:00:00 2001 From: Joli Holmes Date: Tue, 24 Mar 2020 16:03:30 -0500 Subject: [PATCH] modified line code to add lines in the testing data --- R/plots.R | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/R/plots.R b/R/plots.R index 0ffe47a..2a5312f 100644 --- a/R/plots.R +++ b/R/plots.R @@ -256,9 +256,8 @@ state_stats.default <- function(df, y <- df[[y]] color <- df[[color]] - ggplot(df, aes(x = x, y = y, color = color)) + - geom_line() + - geom_point() + + ggplot(data = df, aes(x = x, color = color)) + + geom_point(aes(y = y)) + scale_color_manual(legend_lab, values = as.vector(tpltheme::tpl_palettes$categorical)) + labs(x = x_lab, @@ -273,7 +272,13 @@ state_stats.confirmed <- function(df) { color = "stateName", df = df) - do.call(state_stats, cls) + gg <- do.call(state_stats, cls) + + gg <- gg + + geom_line(aes(y = confirmed)) + + print(gg) + } state_stats.deaths <- function(df) { @@ -283,15 +288,28 @@ state_stats.deaths <- function(df) { color = "stateName", df = df) - do.call(state_stats, cls) + gg <- do.call(state_stats, cls) + + gg <- gg + + geom_line(aes(y = deaths)) + + print(gg) } state_stats.tests <- function(df) { - + cls <- list(y_lab = "# tests", y = "total_tests", color = "stateName", df = df) - - do.call(state_stats, cls) + + gg <- do.call(state_stats, cls) + + gg <- gg + + geom_line(aes(y = total_tests, linetype = "Total")) + + geom_line(aes(y = positive, linetype = "Positive"), alpha = .5) + + geom_line(aes(y = negative, linetype = "Negative"), alpha = .5) + + scale_linetype_manual("Test type",values=c("Total"="solid","Positive"="dotted", "Negative" = "dashed")) + + print(gg) } \ No newline at end of file