Hello,
I have spotted a small bug: split_collect = TRUE fails to produce a unique legend scale for some genes in FeaturePlot_scCustom().
For some reason, for some genes, the legend can be unified, so I suspect something related to ranges of expression between the groups defined by the split.by. Alternatively, maybe the issue is related to recent ggplot2 updates that might have happened? In any case, can you correct the function and update the github dev branch please? Thanks in advance (I really like your package).
(Problem linked to #94 )
Here is a minimal example:
#Required libraries
library(Seurat)
library(scCustomize)
library(SeuratData)
# SeuratData::InstallData("pbmc3k")
# SeuratData::InstallData("ifnb")
#Minimal example using pbmc3k dataset
#Loading
data(pbmc3k)
pbmc3k = UpdateSeuratObject(object = pbmc3k)
pbmc3k = Convert_Assay(seurat_object = pbmc3k, convert_to = "V5")
#Quick pipeline
pbmc3k = NormalizeData(pbmc3k)
pbmc3k = FindVariableFeatures(pbmc3k)
pbmc3k = ScaleData(pbmc3k)
pbmc3k = RunPCA(pbmc3k)
pbmc3k = RunUMAP(pbmc3k, dims = 1:30)
#Graph that produces splitted legends despite asking for unified legend
FeaturePlot_scCustom(seurat_object = pbmc3k,
features = "GAPDH",
na_cutoff = NA,
split.by = "seurat_annotations",
num_columns = 3,
split_collect = TRUE)
#Unsuccessful test with combine = FALSE
FeaturePlot_scCustom(seurat_object = pbmc3k,
features = "GAPDH",
na_cutoff = NA,
split.by = "seurat_annotations",
num_columns = 3,
split_collect = TRUE,
combine = FALSE)
#Graph with split_collect = FALSE, which works as intended
FeaturePlot_scCustom(seurat_object = pbmc3k,
features = "GAPDH",
na_cutoff = NA,
split.by = "seurat_annotations",
num_columns = 3,
split_collect = FALSE)
#For some reasons, it works for some other genes
FeaturePlot_scCustom(seurat_object = pbmc3k,
features = "IL6",
na_cutoff = NA,
split.by = "seurat_annotations",
num_columns = 3,
split_collect = TRUE)
sessionInfo() output
> sessionInfo()
R version 4.5.3 (2026-03-11)
Platform: aarch64-apple-darwin20
Running under: macOS Tahoe 26.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
locale:
[1] C.UTF-8/C.UTF-8/C.UTF-8/C/C.UTF-8/C.UTF-8
time zone: Europe/Paris
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pbmc3k.SeuratData_3.1.4 ifnb.SeuratData_3.0.0 SeuratData_0.2.2.9002
[4] scCustomize_3.2.4.9012 Seurat_5.5.0 SeuratObject_5.4.0
[7] sp_2.2-1
loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-3 rstudioapi_0.18.0 jsonlite_2.0.0
[4] shape_1.4.6.1 magrittr_2.0.5 spatstat.utils_3.2-3
[7] ggbeeswarm_0.7.3 farver_2.1.2 GlobalOptions_0.1.4
[10] vctrs_0.7.3 ROCR_1.0-12 spatstat.explore_3.8-0
[13] paletteer_1.7.0 janitor_2.2.1 htmltools_0.5.9
[16] forcats_1.0.1 sctransform_0.4.3 parallelly_1.47.0
[19] KernSmooth_2.23-26 htmlwidgets_1.6.4 ica_1.0-3
[22] plyr_1.8.9 plotly_4.12.0 zoo_1.8-15
[25] lubridate_1.9.5 igraph_2.3.1 mime_0.13
[28] lifecycle_1.0.5 pkgconfig_2.0.3 Matrix_1.7-4
[31] R6_2.6.1 fastmap_1.2.0 fitdistrplus_1.2-6
[34] future_1.70.0 shiny_1.13.0 snakecase_0.11.1
[37] digest_0.6.39 colorspace_2.1-2 rematch2_2.1.2
[40] patchwork_1.3.2 tensor_1.5.1 RSpectra_0.16-2
[43] irlba_2.3.7 labeling_0.4.3 progressr_0.19.0
[46] spatstat.sparse_3.1-0 timechange_0.4.0 httr_1.4.8
[49] polyclip_1.10-7 abind_1.4-8 compiler_4.5.3
[52] withr_3.0.2 S7_0.2.2 fastDummies_1.7.6
[55] MASS_7.3-65 rappdirs_0.3.4 tools_4.5.3
[58] vipor_0.4.7 lmtest_0.9-40 otel_0.2.0
[61] beeswarm_0.4.0 httpuv_1.6.17 future.apply_1.20.2
[64] goftest_1.2-3 glue_1.8.1 nlme_3.1-168
[67] promises_1.5.0 grid_4.5.3 Rtsne_0.17
[70] cluster_2.1.8.2 reshape2_1.4.5 generics_0.1.4
[73] gtable_0.3.6 spatstat.data_3.1-9 tidyr_1.3.2
[76] data.table_1.18.4 spatstat.geom_3.7-3 RcppAnnoy_0.0.23
[79] ggrepel_0.9.8 RANN_2.6.2 pillar_1.11.1
[82] stringr_1.6.0 spam_2.11-3 RcppHNSW_0.6.0
[85] ggprism_1.0.7 later_1.4.8 circlize_0.4.18
[88] splines_4.5.3 dplyr_1.2.1 lattice_0.22-9
[91] survival_3.8-6 deldir_2.0-4 tidyselect_1.2.1
[94] miniUI_0.1.2 pbapply_1.7-4 gridExtra_2.3
[97] scattermore_1.2 matrixStats_1.5.0 stringi_1.8.7
[100] lazyeval_0.2.3 codetools_0.2-20 tibble_3.3.1
[103] cli_3.6.6 uwot_0.2.4 xtable_1.8-8
[106] reticulate_1.46.0 Rcpp_1.1.1-1.1 globals_0.19.1
[109] spatstat.random_3.4-5 mcprogress_0.1.1 png_0.1-9
[112] ggrastr_1.0.2 spatstat.univar_3.2-0 parallel_4.5.3
[115] ggplot2_4.0.3 dotCall64_1.2 listenv_0.10.1
[118] viridisLite_0.4.3 scales_1.4.0 ggridges_0.5.7
[121] purrr_1.2.2 crayon_1.5.3 rlang_1.2.0
[124] cowplot_1.2.0
>
Hello,
I have spotted a small bug: split_collect = TRUE fails to produce a unique legend scale for some genes in FeaturePlot_scCustom().
For some reason, for some genes, the legend can be unified, so I suspect something related to ranges of expression between the groups defined by the split.by. Alternatively, maybe the issue is related to recent ggplot2 updates that might have happened? In any case, can you correct the function and update the github dev branch please? Thanks in advance (I really like your package).
(Problem linked to #94 )
Here is a minimal example:
sessionInfo() output