renozao / NMF

NMF: A Flexible R package for Nonnegative Matrix Factorization
137 stars 40 forks source link

Incompatible of the parameter for color and breaks #71

Open ETaSky opened 8 years ago

ETaSky commented 8 years ago

Hello, I have an issue with making color= and breaks= work together. I set my own color palette using the following code: my_palette <- colorRampPalette(c("#2060ff", "#00cfff", "#7fffff", "#fff000", "#ff8a00", "#ff0000"))(n=299)
This created a chr vector with 299 elements. I then use following code to generate breaks: col_breaks=c(seq(0,1.5,length=5),seq(1.51,2,length=15),seq(2.01,2.5,length=80),seq(2.51,3,length=150),seq(3.01,3.5,length=40),seq(3.51,4,length=10)) This created a num vector with 300 elements. My data matrix contains values ranging from 0 to 4 with a 2 significant digits. It is very strange that either: aheatmap(GTP_mat,color=my_palette,Colv=NA) or aheatmap(GTP_mat,color="Set2:300",breaks=col_breaks,Colv=NA) works, but whenever I use: aheatmap(GTP_mat,color=my_palette,breaks=col_breaks,Colv=NA), it will produce a heatmap with most of the cells with empty color. I don't know why and how to fix the problem. Thanks.

ccshao commented 7 years ago

similar problems here. empty colors in the many cells in the heatmap. breaks doesnt work in my data. NMF version 0.20.6

sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Manjaro Linux

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

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

other attached packages: [1] NMF_0.20.6 Biobase_2.34.0 BiocGenerics_0.20.0 [4] cluster_2.0.5 rngtools_1.2.4 pkgmaker_0.22
[7] registry_0.3 data.table_1.10.0 magrittr_1.5
[10] RColorBrewer_1.1-2 ggplot2_2.2.1

loaded via a namespace (and not attached): [1] Rcpp_0.12.9 doParallel_1.0.10 munsell_0.4.3 colorspace_1.3-2 [5] xtable_1.8-2 gridBase_0.4-7 foreach_1.4.3 stringr_1.1.0
[9] plyr_1.8.4 tools_3.3.2 gtable_0.2.0 iterators_1.0.8
[13] lazyeval_0.2.0 assertthat_0.1 digest_0.6.11 tibble_1.2
[17] reshape2_1.4.2 codetools_0.2-15 stringi_1.1.2 scales_0.4.1

toddknutson commented 5 years ago

This may help you?? https://github.com/renozao/NMF/issues/125#issuecomment-438368945