Skip to content

Commit

Permalink
Replace deleted code
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaveazure committed Feb 13, 2020
1 parent 099795f commit 25f7022
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,48 @@ FeaturePlot <- function(
}
# Transpose the FeatureHeatmap matrix (not applicable for blended FeaturePlots)
if (combine) {

if (by.col && !is.null(x = split.by) && !blend) {
plots <- lapply(
X = plots,
FUN = function(x) {
return(suppressMessages(
expr = x +
theme_cowplot() +
ggtitle("") +
scale_y_continuous(sec.axis = dup_axis(name = "")) +
no.right
))
}
)
nsplits <- length(x = levels(x = data$split))
idx <- 1
for (i in (length(x = features) * (nsplits - 1) + 1):(length(x = features) * nsplits)) {
plots[[i]] <- suppressMessages(plots[[i]] + scale_y_continuous(sec.axis = dup_axis(name = features[[idx]])) + no.right)
idx <- idx + 1
}
idx <- 1
for (i in which(x = 1:length(x = plots) %% length(x = features) == 1)) {
plots[[i]] <- plots[[i]] + ggtitle(levels(x = data$split)[[idx]]) + theme(plot.title = element_text(hjust = 0.5))
idx <- idx + 1
}
idx <- 1
if (length(x = features) == 1) {
for (i in 1:length(x = plots)) {
plots[[i]] <- plots[[i]] + ggtitle(levels(x = data$split)[[idx]]) + theme(plot.title = element_text(hjust = 0.5))
idx <- idx + 1
}
}
plots <- plots[c(do.call(
what = rbind,
args = split(x = 1:length(x = plots), f = ceiling(x = seq_along(along.with = 1:length(x = plots))/length(x = features)))
))]
plots <- wrap_plots(plots, ncol = nsplits)
} else {
plots <- wrap_plots(plots, ncol = ncol, nrow = split.by %iff% length(x = levels(x = data$split)))
}
if (!is.null(x = legend) && legend == 'none') {
plots <- plots & NoLegend()
}
}
return(plots)
}
Expand Down

0 comments on commit 25f7022

Please sign in to comment.