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

True zero on axis #50

Open
SamGG opened this issue Sep 6, 2019 · 5 comments
Open

True zero on axis #50

SamGG opened this issue Sep 6, 2019 · 5 comments

Comments

@SamGG
Copy link

SamGG commented Sep 6, 2019

Hi,
How can I get a true zero on Y axis? Even if put I set -1000 as lower, no negative ticks are labelled.
Best.

library(ggcyto)
#> Loading required package: ggplot2
#> Loading required package: flowCore
#> Loading required package: ncdfFlow
#> Loading required package: RcppArmadillo
#> Loading required package: BH
#> Loading required package: flowWorkspace
data("GvHD")
fs2 <- GvHD[subset(pData(GvHD), Patient %in% 5:7 & Visit %in% c(5:6))[["name"]]]
autoplot(fs2, "Time", "FL3-H", bins = 64)  + scale_y_flowCore_fasinh(b = 1/5) + ggcyto_par_set(limits = list(x = c(0,1000), y = c(-10, 2e3)), facet = facet_wrap("name"), lab = labs_cyto("marker")) # + theme(axis.text.y=element_blank())
#> Warning: Removed 10 rows containing non-finite values (stat_binhex).
#> Warning: Removed 85 rows containing missing values (geom_hex).

sessionInfo()
#> R version 3.5.3 (2019-03-11)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 7 x64 (build 7601) Service Pack 1
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_United Kingdom.1252 
#> [2] LC_CTYPE=English_United Kingdom.1252   
#> [3] LC_MONETARY=English_United Kingdom.1252
#> [4] LC_NUMERIC=C                           
#> [5] LC_TIME=English_United Kingdom.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] hexbin_1.27.2             ggcyto_1.10.0            
#> [3] flowWorkspace_3.30.0      ncdfFlow_2.28.1          
#> [5] BH_1.69.0-1               RcppArmadillo_0.9.200.4.0
#> [7] flowCore_1.48.1           ggplot2_3.1.0            
#> 
#> loaded via a namespace (and not attached):
#>  [1] tidyselect_0.2.5    purrr_0.2.5         lattice_0.20-38    
#>  [4] pcaPP_1.9-73        colorspace_1.3-2    htmltools_0.3.6    
#>  [7] stats4_3.5.3        yaml_2.2.0          XML_3.98-1.16      
#> [10] rlang_0.3.4         pillar_1.4.0        glue_1.3.1         
#> [13] withr_2.1.2         Rgraphviz_2.26.0    BiocGenerics_0.28.0
#> [16] RColorBrewer_1.1-2  matrixStats_0.54.0  plyr_1.8.4         
#> [19] robustbase_0.93-3   stringr_1.3.1       zlibbioc_1.28.0    
#> [22] munsell_0.5.0       gtable_0.2.0        mvtnorm_1.0-8      
#> [25] evaluate_0.12       labeling_0.3        latticeExtra_0.6-28
#> [28] Biobase_2.42.0      knitr_1.20          parallel_3.5.3     
#> [31] DEoptimR_1.0-8      Rcpp_1.0.1          KernSmooth_2.23-15 
#> [34] corpcor_1.6.9       scales_1.0.0        backports_1.1.2    
#> [37] graph_1.60.0        IDPmisc_1.1.18      gridExtra_2.3      
#> [40] digest_0.6.18       stringi_1.2.4       dplyr_0.8.1        
#> [43] grid_3.5.3          rprojroot_1.3-2     tools_3.5.3        
#> [46] magrittr_1.5        lazyeval_0.2.1      tibble_2.1.1       
#> [49] cluster_2.0.7-1     crayon_1.3.4        rrcov_1.4-7        
#> [52] pkgconfig_2.0.2     MASS_7.3-51.1       data.table_1.11.8  
#> [55] flowViz_1.46.0      assertthat_0.2.1    rmarkdown_1.10     
#> [58] R6_2.4.0            compiler_3.5.3

Created on 2019-09-06 by the reprex package (v0.2.1)

@jacobpwagner
Copy link
Member

Hey @SamGG , could you please give me your sessionInfo() output? It will help me figure this out.

@SamGG
Copy link
Author

SamGG commented Sep 6, 2019

Hi Jacob. Request updated. Best

@jacobpwagner
Copy link
Member

jacobpwagner commented Sep 9, 2019

Hi @SamGG , I'm having trouble reproducing the plot you're seeing. It seems to be giving me a true zero on the y axis. That is, this:

autoplot(fs2, "Time", "FL3-H", bins = 64) + scale_y_flowCore_fasinh(b=1/5) + ggcyto_par_set(limits=list(x=c(0,1000), y=c(-10, 2e3)), facet=facet_wrap("name"), lab=labs_cyto("marker"))

gives me this:

test_plot_neg10

If I just set the y axis to a minimum of 0, it seems to do that appropriately:

autoplot(fs2, "Time", "FL3-H", bins = 64) + scale_y_flowCore_fasinh(b=1/5) + ggcyto_par_set(limits=list(x=c(0,1000), y=c(0, 2e3)), facet=facet_wrap("name"), lab=labs_cyto("marker"))

test_plot_0

I should mention that I am using Bioconductor's 3.8 Docker image to test this, which is at R 3.5.2 and ggplot2 3.2.1, so it's possible there is a difference there that is responsible for the misrepresentation of zero. There are minor version bumps on ggcyto and flowWorkspace over what you have but I don't think they are relevant to this. My full sessionInfo() for reference:

R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux buster/sid

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

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] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggcyto_1.10.2             flowWorkspace_3.30.2     
[3] ncdfFlow_2.28.1           BH_1.69.0-1              
[5] RcppArmadillo_0.9.700.2.0 flowCore_1.48.1          
[7] ggplot2_3.2.1            

loaded via a namespace (and not attached):
 [1] pcaPP_1.9-73        Rcpp_1.0.2          plyr_1.8.4         
 [4] RColorBrewer_1.1-2  pillar_1.4.2        compiler_3.5.2     
 [7] DEoptimR_1.0-8      BiocManager_1.30.4  zlibbioc_1.28.0    
[10] tools_3.5.2         tibble_2.1.3        gtable_0.3.0       
[13] lattice_0.20-38     pkgconfig_2.0.2     rlang_0.4.0        
[16] graph_1.60.0        Rgraphviz_2.26.0    parallel_3.5.2     
[19] mvtnorm_1.0-11      hexbin_1.27.3       gridExtra_2.3      
[22] stringr_1.4.0       withr_2.1.2         dplyr_0.8.3        
[25] cluster_2.1.0       IDPmisc_1.1.19      stats4_3.5.2       
[28] grid_3.5.2          tidyselect_0.2.5    data.table_1.12.2  
[31] glue_1.3.1          robustbase_0.93-5   Biobase_2.42.0     
[34] R6_2.4.0            rrcov_1.4-7         XML_3.98-1.20      
[37] latticeExtra_0.6-28 purrr_0.3.2         corpcor_1.6.9      
[40] magrittr_1.5        scales_1.0.0        matrixStats_0.54.0 
[43] BiocGenerics_0.28.0 MASS_7.3-51.4       assertthat_0.2.1   
[46] colorspace_1.4-1    labeling_0.3        KernSmooth_2.23-15 
[49] stringi_1.4.3       flowViz_1.46.1      lazyeval_0.2.2     
[52] munsell_0.5.0       crayon_1.3.4  

As for the negative ticks, it's just not adding them because there is no data in that range. But you could always add explicit ticks if that were desired. As a side note, it looks like I am really having trouble reproducing your plots in the recent versions of the packages because the bins are not being re-evaluated appropriately during the re-scaling of the axis. The same plotting code above in the current trunk branch gives me this:

plot_zoom_png

which is clearly problematic and I'll be opening an issue for that soon. I'll still loop back to figure out the discrepancy over the zero on the axis as time allows.

@SamGG
Copy link
Author

SamGG commented Sep 9, 2019

Hi. Thanks for looking at my question, but don't waste your time on that. I am currently updating all packages on order to get an up-to-date setup with R3.5.3. I will let you about the result. I guess I will have to switch to R3.6 and to Bioc 3.9. Best

@jacobpwagner
Copy link
Member

Sounds good, and I appreciate it. I'm actually trying to run down this scaling issue that persists in Bioc 3.9, so your post has actually been really helpful in that regard. But I think I've found the problem and I'll have it fixed soon.

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