diff --git a/DESCRIPTION b/DESCRIPTION index 4a6398a9..d8f9856b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,7 +36,7 @@ Encoding: UTF-8 LazyData: true Depends: R (>= 3.5.0), - ggplot2 + ggplot2 (>= 3.4.0) Imports: dplyr, generics, diff --git a/R/default_aes.R b/R/default_aes.R index ada2ebb3..2b3ba83a 100644 --- a/R/default_aes.R +++ b/R/default_aes.R @@ -15,7 +15,7 @@ init_cmap_default_aes <- function() { colour = cmapplot_globals$colors$blackish ), Line = list( - size = gg_lwd_convert(cmapplot_globals$consts$lwd_plotline) + linewidth = gg_lwd_convert(cmapplot_globals$consts$lwd_plotline) ), Text = list( family = cmapplot_globals$font$strong$family, diff --git a/R/geom_pandemics.R b/R/geom_pandemics.R index 5a89ed8c..c9f1d50a 100644 --- a/R/geom_pandemics.R +++ b/R/geom_pandemics.R @@ -252,7 +252,7 @@ GeomPandemics <- ggproto( default_aes = aes( colour = NA, alpha = 0.11, - size = 0.5, + linewidth = 0.5, linetype = 1, na.rm = TRUE, show.legend = FALSE @@ -324,7 +324,7 @@ GeomPandemics <- ggproto( gp = gpar( col = coords$colour, fill = alpha(coords$fill, coords$alpha), - lwd = coords$size * .pt, + lwd = coords$linewidth * .pt, lty = coords$linetype, linejoin = linejoin, # `lineend` is a workaround for Windows and intentionally kept unexposed diff --git a/R/geom_recessions.R b/R/geom_recessions.R index 17549d4e..e0c3682d 100644 --- a/R/geom_recessions.R +++ b/R/geom_recessions.R @@ -307,15 +307,8 @@ NULL #' @usage NULL #' @export GeomRecessions <- ggproto( - "GeomRecessions", - Geom, - default_aes = aes( - colour = NA, - alpha = 0.11, - size = 0.5, - linetype = 1, - na.rm = TRUE - ), + "GeomRecessions", Geom, + default_aes = aes(colour = NA, alpha = 0.11, linewidth = 0.5, linetype = 1, na.rm = TRUE), required_aes = c( "xformat", @@ -371,25 +364,21 @@ GeomRecessions <- ggproto( ggname("bar", do.call("grobTree", polys)) } else { coords <- coord$transform(data, panel_params) - ggname( - "geom_rect", - rectGrob( - coords$xmin, - coords$ymax, - width = coords$xmax - coords$xmin, - height = coords$ymax - coords$ymin, - default.units = "native", - just = c("left", "top"), - gp = gpar( - col = coords$colour, - fill = alpha(coords$fill, coords$alpha), - lwd = coords$size * .pt, - lty = coords$linetype, - linejoin = linejoin, - # `lineend` is a workaround for Windows and intentionally kept unexposed - # as an argument. (c.f. https://github.com/tidyverse/ggplot2/issues/3037#issuecomment-457504667) - lineend = if (identical(linejoin, "round")) "round" else "square" - ) + ggname("geom_rect", rectGrob( + coords$xmin, coords$ymax, + width = coords$xmax - coords$xmin, + height = coords$ymax - coords$ymin, + default.units = "native", + just = c("left", "top"), + gp = gpar( + col = coords$colour, + fill = alpha(coords$fill, coords$alpha), + lwd = coords$linewidth * .pt, + lty = coords$linetype, + linejoin = linejoin, + # `lineend` is a workaround for Windows and intentionally kept unexposed + # as an argument. (c.f. https://github.com/tidyverse/ggplot2/issues/3037#issuecomment-457504667) + lineend = if (identical(linejoin, "round")) "round" else "square" ) ) } diff --git a/R/theme_cmap.R b/R/theme_cmap.R index e2c95b3f..8ab66e45 100644 --- a/R/theme_cmap.R +++ b/R/theme_cmap.R @@ -156,7 +156,7 @@ theme_cmap <- function( if(!is.null(hline)){ add_to_obj(ggplot2::geom_hline( yintercept = hline, - size = gg_lwd_convert(consts$lwd_strongline), + linewidth = gg_lwd_convert(consts$lwd_strongline), color = cmapplot_globals$colors$blackish)) } @@ -164,7 +164,7 @@ theme_cmap <- function( if(!is.null(vline)){ add_to_obj(ggplot2::geom_vline( xintercept = vline, - size = gg_lwd_convert(consts$lwd_strongline), + linewidth = gg_lwd_convert(consts$lwd_strongline), color = cmapplot_globals$colors$blackish)) } @@ -184,35 +184,35 @@ theme_cmap <- function( # horizontal gridlines, if specified if (grepl("h", gridlines)) { attr[["panel.grid.major.y"]] <- ggplot2::element_line( - size = gg_lwd_convert(consts$lwd_gridline), + linewidth = gg_lwd_convert(consts$lwd_gridline), color = cmapplot_globals$colors$blackish) } # vertical gridlines, if specified if (grepl("v", gridlines)) { attr[["panel.grid.major.x"]] <- ggplot2::element_line( - size = gg_lwd_convert(consts$lwd_gridline), + linewidth = gg_lwd_convert(consts$lwd_gridline), color = cmapplot_globals$colors$blackish) } # x axis line, if specified if (grepl("x", axislines)) { attr[["axis.line.x"]] <- ggplot2::element_line( - size = gg_lwd_convert(consts$lwd_gridline), + linewidth = gg_lwd_convert(consts$lwd_gridline), color = cmapplot_globals$colors$blackish) } # y axis line, if specified if (grepl("y", axislines)) { attr[["axis.line.y"]] <- ggplot2::element_line( - size = gg_lwd_convert(consts$lwd_gridline), + linewidth = gg_lwd_convert(consts$lwd_gridline), color = cmapplot_globals$colors$blackish) } # x axis ticks, if specified if (grepl("x", axisticks)) { attr[["axis.ticks.x"]] <- ggplot2::element_line( - size = gg_lwd_convert(consts$lwd_gridline), + linewidth = gg_lwd_convert(consts$lwd_gridline), color = cmapplot_globals$colors$blackish) attr[["axis.ticks.length.x"]] <- unit(consts$length_ticks,"bigpts") @@ -221,7 +221,7 @@ theme_cmap <- function( # y axis ticks, if specified if (grepl("y", axisticks)) { attr[["axis.ticks.y"]] <- ggplot2::element_line( - size = gg_lwd_convert(consts$lwd_gridline), + linewidth = gg_lwd_convert(consts$lwd_gridline), color = cmapplot_globals$colors$blackish) attr[["axis.ticks.length.y"]] <- unit(consts$length_ticks,"bigpts") @@ -262,18 +262,18 @@ theme_cmap_base <- function(consts = cmapplot_globals$consts, # building blocks line = element_line( colour = cmapplot_globals$colors$blackish, - size = gg_lwd_convert(consts$lwd_gridline), + linewidth = gg_lwd_convert(consts$lwd_gridline), linetype = 1, lineend = "butt", inherit.blank = TRUE), rect = element_rect( fill = NA, colour = ifelse(debug, "blue", NA), - size = 0.5, linetype = 1, + linewidth = 0.5, linetype = 1, inherit.blank = TRUE), text = element_text( family = cmapplot_globals$font$regular$family, - face = cmapplot_globals$fgiont$regular$face, + face = cmapplot_globals$font$regular$face, size = cmapplot_globals$fsize$M, color = cmapplot_globals$colors$blackish, lineheight = 0.9, hjust = 0.5, vjust = 0.5, angle = 0,