Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Encoding: UTF-8
LazyData: true
Depends:
R (>= 3.5.0),
ggplot2
ggplot2 (>= 3.4.0)
Imports:
dplyr,
generics,
Expand Down
2 changes: 1 addition & 1 deletion R/default_aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions R/geom_pandemics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
45 changes: 17 additions & 28 deletions R/geom_recessions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
)
)
}
Expand Down
22 changes: 11 additions & 11 deletions R/theme_cmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ 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))
}

# y origin line, if specified
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))
}

Expand All @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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,
Expand Down
Loading