From 3418f67f64f1471ead7259f7461ff30c61e1cc7e Mon Sep 17 00:00:00 2001 From: Billsfriend <43401982+Billsfriend@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:51:25 +0800 Subject: [PATCH] fix: avoid ggplot2 deprecation warning change facet_wrap() param and switch aes_string() to aes() in DotPlot() --- R/visualization.R | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/R/visualization.R b/R/visualization.R index d56389c06..2fbe47ecc 100644 --- a/R/visualization.R +++ b/R/visualization.R @@ -4558,16 +4558,16 @@ DotPlot <- function( splits.use <- unlist(x = lapply( X = data.plot$id, FUN = function(x) - sub( - paste0(".*_(", - paste(sort(unique(x = splits), decreasing = TRUE), - collapse = '|' - ),")$"), - "\\1", - x + sub( + paste0(".*_(", + paste(sort(unique(x = splits), decreasing = TRUE), + collapse = '|' + ),")$"), + "\\1", + x ) - ) - ) + ) + ) data.plot$colors <- mapply( FUN = function(color, value) { return(colorRampPalette(colors = c('grey', color))(20)[value]) @@ -4589,8 +4589,8 @@ DotPlot <- function( levels = unique(x = feature.groups) ) } - plot <- ggplot(data = data.plot, mapping = aes_string(x = 'features.plot', y = 'id')) + - geom_point(mapping = aes_string(size = 'pct.exp', color = color.by)) + + plot <- ggplot(data = data.plot, mapping = aes(x = .data$features.plot, y = .data$id)) + + geom_point(mapping = aes(size = .data$pct.exp, color = .data[[color.by]])) + scale.func(range = c(0, dot.scale), limits = c(scale.min, scale.max)) + theme(axis.title.x = element_blank(), axis.title.y = element_blank()) + guides(size = guide_legend(title = 'Percent Expressed')) + @@ -4601,7 +4601,7 @@ DotPlot <- function( theme_cowplot() if (!is.null(x = feature.groups)) { plot <- plot + facet_grid( - facets = ~feature.groups, + rows = ~feature.groups, scales = "free_x", space = "free_x", switch = "y"