Skip to content

Commit

Permalink
Change the number of bins in dot plot for the FeatureStatPlot function
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghao-njmu committed Nov 25, 2023
1 parent 3a8c86a commit c2acf76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/SCP-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -4183,7 +4183,7 @@ ExpressionStatPlot <- function(exp.data, meta.data, stat.by, group.by = NULL, sp
y_min_use <- layer_scales(p)$y$range$range[1]
}
if (plot_type == "dot") {
bins <- cut(dat$value, breaks = seq(y_min_use, y_max_use, length.out = 15), include.lowest = TRUE)
bins <- cut(dat$value, breaks = seq(y_min_use, y_max_use, length.out = 10), include.lowest = TRUE)
bins_median <- sapply(strsplit(levels(bins), ","), function(x) median(as.numeric(gsub("\\(|\\)|\\[|\\]", "", x)), na.rm = TRUE))
names(bins_median) <- levels(bins)
dat[["bins"]] <- bins_median[bins]
Expand Down

0 comments on commit c2acf76

Please sign in to comment.