Skip to content

Commit

Permalink
Add option to rasterize geom_point layer
Browse files Browse the repository at this point in the history
  • Loading branch information
benostendorf committed Jul 18, 2020
1 parent e9fa07b commit 986166c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/EnhancedVolcano.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
#' @param border Add a border for just the x and y axes ('partial') or the
#' entire plot grid ('full')?
#' @param borderWidth Width of the border on the x and y axes.
#' @param borderColour Colour of the border on the x and y axes.
#' @param borderColour Colour of the border on the x and y axes.
#' @param raster Logical, indicating whether to rasterize the geom_point layer.
#'
#' @details
#' Volcano plots represent a useful way to visualise the results of differential expression analyses. Here, we present a highly-configurable function that produces publication-ready volcano plots [@EnhancedVolcano]. \code{EnhancedVolcano} will attempt to fit as many variable names in the plot window as possible, thus avoiding 'clogging' up the plot with labels that could not otherwise have been read.
Expand Down Expand Up @@ -240,7 +241,8 @@ EnhancedVolcano <- function(
gridlines.minor = TRUE,
border = 'partial',
borderWidth = 0.8,
borderColour = 'black')
borderColour = 'black',
raster = FALSE)
{
if(!is.numeric(toptable[[x]])) {
stop(paste(x, ' is not numeric!', sep=''))
Expand All @@ -249,6 +251,11 @@ EnhancedVolcano <- function(
if(!is.numeric(toptable[[y]])) {
stop(paste(y, ' is not numeric!', sep=''))
}

if (raster) {
require(ggrastr)
geom_point <- ggrastr::geom_point_rast
}

i <- xvals <- yvals <- Sig <- NULL

Expand Down

0 comments on commit 986166c

Please sign in to comment.