diff --git a/DESCRIPTION b/DESCRIPTION index c0516cb5..8732bdee 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,7 +35,7 @@ Imports: colourpicker, DT (>= 0.2), dygraphs (>= 1.1.1.2), - ggplot2 (>= 2.1.1), + ggplot2 (>= 3.4.0), gridExtra, gtools, markdown (>= 0.7.4), diff --git a/inst/ShinyStan/helper_functions/gg_theme_elements.R b/inst/ShinyStan/helper_functions/gg_theme_elements.R index dbf7795d..1aa21fe9 100644 --- a/inst/ShinyStan/helper_functions/gg_theme_elements.R +++ b/inst/ShinyStan/helper_functions/gg_theme_elements.R @@ -20,8 +20,8 @@ title_txt <- theme( plot.title = element_text(face = "bold", size = 14) ) fat_axis <- theme( - axis.line.x = element_line(size = 3, color = axis_line_color), - axis.line.y = element_line(size = 0.5, color = axis_line_color) + axis.line.x = element_line(linewidth = 3, color = axis_line_color), + axis.line.y = element_line(linewidth = 0.5, color = axis_line_color) ) no_yaxs <- theme( axis.line.y = element_blank(), @@ -38,11 +38,11 @@ strip_txt <- theme( # horizontal and vertical lines ------------------------------------------- h_lines <- theme( - panel.grid.major = element_line(size = 0.10, linetype = 3, color = "turquoise4"), + panel.grid.major = element_line(linewidth = 0.10, linetype = 3, color = "turquoise4"), panel.grid.major.x = element_blank() ) v_lines <- theme( - panel.grid.major = element_line(size = 0.25, linetype = 3, color = "turquoise4"), + panel.grid.major = element_line(linewidth = 0.25, linetype = 3, color = "turquoise4"), panel.grid.major.y = element_blank() ) diff --git a/inst/ShinyStan/helper_functions/hmc_diagnostics_helpers.R b/inst/ShinyStan/helper_functions/hmc_diagnostics_helpers.R index 7a08f43b..e769182c 100644 --- a/inst/ShinyStan/helper_functions/hmc_diagnostics_helpers.R +++ b/inst/ShinyStan/helper_functions/hmc_diagnostics_helpers.R @@ -110,14 +110,14 @@ thm_no_yaxs <- thm + no_yaxs base <- ggplot(mdf, aes(x = value)) + geom_histogram(aes_string(y="..density.."), binwidth = diff(range(mdf$value))/30, fill = base_fill, - color = vline_base_clr, size = 0.2) + + color = vline_base_clr, linewidth = 0.2) + labs(x = if (missing(lab)) NULL else lab, y = "") + thm if (chain == 0) { graph <- base + - geom_vline(xintercept = mean(mdf$value), color = vline_base_clr, size = .8) + - geom_vline(xintercept = median(mdf$value), color = vline_base_clr, lty = 2, size = 1) + geom_vline(xintercept = mean(mdf$value), color = vline_base_clr, linewidth = .8) + + geom_vline(xintercept = median(mdf$value), color = vline_base_clr, lty = 2, linewidth = 1) return(graph) } chain_data <- subset(mdf, variable == paste0("chain:",chain)) @@ -127,9 +127,9 @@ thm_no_yaxs <- thm + no_yaxs aes_string(y="..density.."), binwidth = diff(range(chain_data$value))/30, fill = chain_fill, alpha = 0.5) + - geom_vline(xintercept = mean(chain_data$value), color = chain_clr, size = .8) + + geom_vline(xintercept = mean(chain_data$value), color = chain_clr, linewidth = .8) + geom_vline(xintercept = median(chain_data$value), - color = chain_clr, lty = 2, size = 1) + color = chain_clr, lty = 2, linewidth = 1) } .treedepth_ndivergent_hist <- function(df_td, df_nd, chain = 0, divergent = c("All", 0, 1)) { @@ -148,7 +148,7 @@ thm_no_yaxs <- thm + no_yaxs graph <- ggplot(plot_data, aes(x = factor(value)), na.rm = TRUE) + geom_bar(aes(y=..count../sum(..count..)), width=1, fill = base_fill, - color = vline_base_clr, size = 0.2) + + color = vline_base_clr, linewidth = 0.2) + plot_labs + plot_theme if (chain == 0) diff --git a/inst/ShinyStan/helper_functions/shinystan_helpers.R b/inst/ShinyStan/helper_functions/shinystan_helpers.R index 5f7ea413..16c3f14e 100644 --- a/inst/ShinyStan/helper_functions/shinystan_helpers.R +++ b/inst/ShinyStan/helper_functions/shinystan_helpers.R @@ -39,7 +39,7 @@ graph <- ggplot(dat, aes(x = iterations, y = value, color = chains)) graph <- graph + xy_labs + clrs + theme_classic() %+replace% (axis_color + axis_labs + fat_axis + h_lines + lgnd_top + lgnd_txt + strip_txt + transparent) if (rect != "None") graph <- graph + shading_rect - graph <- graph + geom_line(size = 0.35) + scale_x_continuous(limits = c(x1, x2)) + graph <- graph + geom_line(linewidth = 0.35) + scale_x_continuous(limits = c(x1, x2)) if (layout == "Grid") { graph <- graph + facet_wrap(~ parameters, scales = "free_y") @@ -76,10 +76,10 @@ graph <- ggplot(dat, aes(x = value)) if (binwd == 0) { - graph <- graph + geom_histogram(fill = fill_color, color = line_color, size = 0.2) + graph <- graph + geom_histogram(fill = fill_color, color = line_color, linewidth = 0.2) } else { graph <- graph + geom_histogram(fill = fill_color, color = line_color, - binwidth = binwd, size = 0.2) + binwidth = binwd, linewidth = 0.2) } graph <- graph + labs(x = x_lab, y = "") + @@ -266,7 +266,7 @@ priors <- data.frame(family = c("Normal", "t", "Cauchy", "Beta", "Exponential", graph <- ggplot(ac_dat, aes(x= lag, y = ac)) graph <- graph + geom_bar(position = "identity", stat = "identity", - fill = base_fill, size = 0.4) + + fill = base_fill, linewidth = 0.4) + y_scale + ac_labs + ac_theme @@ -278,7 +278,7 @@ priors <- data.frame(family = c("Normal", "t", "Cauchy", "Beta", "Exponential", graph <- ggplot(ac_dat, aes(x = lag, y = ac, color = factor(chains), fill = factor(chains))) graph <- graph + - geom_bar(position = "identity", stat = "identity", size = 0.4) + + geom_bar(position = "identity", stat = "identity", linewidth = 0.4) + scale_fill_manual(values = rep(base_fill, nChains)) + scale_color_manual(values = rep(vline_base_clr, nChains)) + y_scale + @@ -372,10 +372,10 @@ priors <- data.frame(family = c("Normal", "t", "Cauchy", "Beta", "Exponential", axis.ticks.y = element_blank(), axis.text= element_text(size=12), axis.text.y= element_text(face = "bold"), - axis.line= element_line(size = 4, color = axis_line_color), - axis.line.y= element_line(size = 0.5, color = axis_line_color), + axis.line= element_line(linewidth = 4, color = axis_line_color), + axis.line.y= element_line(linewidth = 0.5, color = axis_line_color), legend.position = "none", - panel.grid.major = element_line(size = 0.4), + panel.grid.major = element_line(linewidth = 0.4), panel.grid.minor.y = element_blank()) p.all <- p.base + xlim(xlim.use) + p.name + theme_bw() + p.theme + transparent @@ -424,18 +424,18 @@ priors <- data.frame(family = c("Normal", "t", "Cauchy", "Beta", "Exponential", #point estimator if (color_by_rhat) { p.point <- geom_segment(aes(x = m, xend = m, y = y, yend = y + 0.25, - color = rhat_id), size = 1.5) + color = rhat_id), linewidth = 1.5) p.all + p.poly + p.den + p.col + p.point + rhat_colors + rhat_lgnd } else { p.point <- geom_segment(aes(x = m, xend = m, y = y, yend = y + 0.25), colour = est_color, - size = 1.5) + linewidth = 1.5) p.all + p.poly + p.den + p.col + p.point } } else { p.ci.2 <- geom_segment(aes(x = l, xend = h, y = y, yend = y), - colour = fill_color, size = 2) + colour = fill_color, linewidth = 2) if (color_by_rhat) { p.point <- geom_point(aes(x = m, y = y, fill = rhat_id), color = "black", shape = 21, size = 4) @@ -460,7 +460,7 @@ priors <- data.frame(family = c("Normal", "t", "Cauchy", "Beta", "Exponential", my_labs <- labs(y = "", x = xlab) base_fill graph <- qplot(x = x, data = dat, color = I(vline_base_clr), - fill = I(base_fill), size = I(0.2)) + fill = I(base_fill), linewidth = I(0.2)) graph <- graph + my_labs + theme_classic() %+replace% (axis_color + axis_labs + fat_axis + no_yaxs + transparent) @@ -652,7 +652,7 @@ priors <- data.frame(family = c("Normal", "t", "Cauchy", "Beta", "Exponential", } if (ellipse_lev != "None") graph <- graph + stat_ellipse(level = as.numeric(ellipse_lev), color = ellipse_color, - linetype = ellipse_lty, size = ellipse_lwd, alpha = ellipse_alpha) + linetype = ellipse_lty, linewidth = ellipse_lwd, alpha = ellipse_alpha) if (!all(dat$divergent == 0)) graph <- graph + geom_point(data = subset(dat, divergent == 1), aes(x,y), size = pt_size + 0.5, shape = 21,