Skip to content

Commit

Permalink
Fix ncol setting for DimPlot when using split.by
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaveazure committed Feb 20, 2020
1 parent db87d82 commit fac062e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ DimPlot <- function(
data <- as.data.frame(x = data)
dims <- paste0(Key(object = object[[reduction]]), dims)
object[['ident']] <- Idents(object = object)
orig.groups <- group.by
group.by <- group.by %||% 'ident'
data[, group.by] <- object[[group.by]][cells, , drop = FALSE]
for (group in group.by) {
Expand Down Expand Up @@ -800,11 +801,11 @@ DimPlot <- function(
return(plot)
}
)
if( !is.null(x = split.by) && length(x = group.by) > 1) {
if (!is.null(x = split.by) && length(x = group.by) > 1) {
ncol <- 1
}
if (combine) {
plots <- wrap_plots(plots, ncol = ncol)
plots <- wrap_plots(plots, ncol = orig.groups %iff% ncol)
}
return(plots)
}
Expand Down

0 comments on commit fac062e

Please sign in to comment.