Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jjVolcano: This palatte have 12 colors! #37

Open
CJ-Liu opened this issue Dec 21, 2023 · 2 comments
Open

jjVolcano: This palatte have 12 colors! #37

CJ-Liu opened this issue Dec 21, 2023 · 2 comments

Comments

@CJ-Liu
Copy link

CJ-Liu commented Dec 21, 2023

Dear @junjunlab thanks for your great package. When I used jjVolcano function with demo pbmc data, it encountered the following error, could you give some suggestions to fix the problem, thanks a lot.

jjVolcano(diffData = pbmc.markers)

This palatte have 12 colors!

Scale for y is already present.
Adding another scale for y, which will replace the existing scale.
ERROR while rich displaying an object: Error in palette():
! Insufficient values in manual scale. 15 needed but only 9 provided.

Traceback:

  1. tryCatch(withCallingHandlers({
    . if (!mime %in% names(repr::mime2repr))
    . stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
    . rpr <- repr::mime2repr[mime]
    . if (is.null(rpr))
    . return(NULL)
    . prepare_content(is.raw(rpr), rpr)
    . }, error = error_handler), error = outer_handler)
  2. tryCatchList(expr, classes, parentenv, handlers)
  3. tryCatchOne(expr, names, parentenv, handlers[[1L]])
  4. doTryCatch(return(expr), name, parentenv, handler)
  5. withCallingHandlers({
    . if (!mime %in% names(repr::mime2repr))
    . stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
    . rpr <- repr::mime2repr[mime]
    . if (is.null(rpr))
    . return(NULL)
    . prepare_content(is.raw(rpr), rpr)
    . }, error = error_handler)
  6. repr::mime2repr[mime]
  7. repr_text.default(obj)
  8. paste(capture.output(print(obj)), collapse = "\n")
  9. capture.output(print(obj))
  10. withVisible(...elt(i))
  11. print(obj)
  12. print.ggplot(obj)
  13. ggplot_build(x)
  14. ggplot_build.ggplot(x)
  15. lapply(data, scales_map_df, scales = npscales)
  16. FUN(X[[i]], ...)
  17. unlist(lapply(scales$scales, function(scale) scale$map_df(df = df)),
    . recursive = FALSE)
  18. lapply(scales$scales, function(scale) scale$map_df(df = df))
  19. FUN(X[[i]], ...)
  20. scale$map_df(df = df)
  21. map_df(..., self = self)
  22. lapply(aesthetics, function(j) self$map(df[[j]]))
  23. FUN(X[[i]], ...)
  24. self$map(df[[j]])
  25. map(..., self = self)
  26. self$palette(n)
  27. palette(...)
  28. cli::cli_abort("Insufficient values in manual scale. {n} needed but only {length(values)} provided.")
  29. rlang::abort(message, ..., call = call, use_cli_format = TRUE,
    . .frame = .frame)
  30. signal_abort(cnd, .file)

sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /opt/conda/lib/libopenblasp-r0.3.21.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base

other attached packages:
[1] ComplexHeatmap_2.10.0 ggalluvial_0.12.5 corrplot_0.92
[4] scRNAtoolVis_0.0.7 lubridate_1.9.3 forcats_1.0.0
[7] stringr_1.5.1 purrr_1.0.2 readr_2.1.4
[10] tidyr_1.3.0 tibble_3.2.1 tidyverse_2.0.0
[13] RColorBrewer_1.1-3 repr_1.1.4 dplyr_1.1.4
[16] ggplot2_3.4.4 Seurat_5.0.1 SeuratObject_5.0.1
[19] sp_2.1-2

loaded via a namespace (and not attached):
[1] circlize_0.4.15 uuid_1.1-1 spam_2.10-0
[4] plyr_1.8.9 igraph_1.6.0 jjAnno_0.0.3
[7] lazyeval_0.2.2 splines_4.1.3 RcppHNSW_0.5.0
[10] listenv_0.9.0 scattermore_1.2 digest_0.6.33
[13] foreach_1.5.2 htmltools_0.5.7 fansi_1.0.6
[16] magrittr_2.0.3 tensor_1.5 cluster_2.1.4
[19] doParallel_1.0.17 ROCR_1.0-11 tzdb_0.4.0
[22] globals_0.16.2 matrixStats_1.2.0 timechange_0.2.0
[25] spatstat.sparse_3.0-3 colorspace_2.1-0 ggrepel_0.9.4
[28] crayon_1.5.2 jsonlite_1.8.8 progressr_0.14.0
[31] spatstat.data_3.0-3 survival_3.4-0 zoo_1.8-12
[34] iterators_1.0.14 glue_1.6.2 polyclip_1.10-4
[37] gtable_0.3.4 leiden_0.4.3.1 GetoptLong_1.0.5
[40] shape_1.4.6 future.apply_1.11.0 BiocGenerics_0.40.0
[43] abind_1.4-5 scales_1.3.0 spatstat.random_3.2-2
[46] miniUI_0.1.1.1 Rcpp_1.0.11 viridisLite_0.4.2
[49] xtable_1.8-4 clue_0.3-64 reticulate_1.34.0
[52] dotCall64_1.1-1 stats4_4.1.3 htmlwidgets_1.6.4
[55] httr_1.4.7 ellipsis_0.3.2 ica_1.0-3
[58] farver_2.1.1 pkgconfig_2.0.3 uwot_0.1.16
[61] deldir_2.0-2 utf8_1.2.4 labeling_0.4.3
[64] tidyselect_1.2.0 rlang_1.1.2 reshape2_1.4.4
[67] later_1.3.2 munsell_0.5.0 tools_4.1.3
[70] cli_3.6.2 generics_0.1.3 ggridges_0.5.4
[73] evaluate_0.23 fastmap_1.1.1 ggdendro_0.1.23
[76] goftest_1.2-3 fitdistrplus_1.1-11 RANN_2.6.1
[79] pbapply_1.7-2 future_1.33.0 nlme_3.1-160
[82] mime_0.12 compiler_4.1.3 plotly_4.10.3
[85] png_0.1-8 spatstat.utils_3.0-4 stringi_1.8.3
[88] RSpectra_0.16-1 lattice_0.20-45 IRdisplay_1.1
[91] Matrix_1.6-4 ggsci_3.0.0 vctrs_0.6.5
[94] pillar_1.9.0 lifecycle_1.0.4 spatstat.geom_3.2-7
[97] lmtest_0.9-40 GlobalOptions_0.1.2 RcppAnnoy_0.0.21
[100] data.table_1.14.10 cowplot_1.1.1 irlba_2.3.5.1
[103] httpuv_1.6.13 patchwork_1.1.3 R6_2.5.1
[106] promises_1.2.1 KernSmooth_2.23-20 gridExtra_2.3
[109] IRanges_2.28.0 parallelly_1.36.0 codetools_0.2-18
[112] fastDummies_1.7.3 MASS_7.3-58.1 rjson_0.2.21
[115] withr_2.5.2 sctransform_0.4.1 S4Vectors_0.32.4
[118] parallel_4.1.3 hms_1.1.3 IRkernel_1.3.1
[121] Rtsne_0.17 pbdZMQ_0.3-8 spatstat.explore_3.2-5
[124] shiny_1.8.0 base64enc_0.1-3

@junjunlab
Copy link
Owner

Please given enough colors according the error infomation by using scale_color/fill_manual() function.

@CJ-Liu
Copy link
Author

CJ-Liu commented Dec 22, 2023

@junjunlab I solved this error using the method you introduced. Thank you very much, and sorry that I did not notice this key prompt: “! Insufficient values in manual scale. 15 needed but only 9 provided.”

jjVolcano(diffData = pbmc.markers, log2FC.cutoff=0.25) +
scale_color_manual(values = cols) +
scale_fill_manual(values = cols)
note: cols is a vector that stores the color used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants