Skip to content

Commit

Permalink
Update style
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaveazure committed Feb 19, 2020
1 parent 57e90c4 commit ff6c015
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,10 @@ FeaturePlot <- function(
if (j == length(x = features) && !blend) {
suppressMessages(
expr = plot <- plot +
scale_y_continuous(sec.axis = dup_axis(name = ident),
limits = ylims) +
scale_y_continuous(
sec.axis = dup_axis(name = ident),
limits = ylims
) +
no.right
)
}
Expand Down Expand Up @@ -1269,27 +1271,38 @@ FeaturePlot <- function(
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]]),
limits = ylims) +
no.right)
plots[[i]] <- suppressMessages(
expr = plots[[i]] +
scale_y_continuous(
sec.axis = dup_axis(name = features[[idx]]),
limits = ylims
) +
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))
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))
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)))
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 {
Expand Down

0 comments on commit ff6c015

Please sign in to comment.