Closed NHPatterson closed 6 months ago
I was recently plotting some binary masks and found this potential bug when plotting a binary mask where all values are equal. Seems to be more related to image.default than Cardinal itself but it could be an issue for someone else at some point.
image.default
Cardinal
Minimal reproducible example...
xy <- expand.grid(x=c(1:5),y=c(1:5)) ms_data <- matrix(1, ncol=nrow(xy),nrow=1) cdata <- MSImagingExperiment( imageData = ms_data, featureData = MassDataFrame(mz = 1), pixelData = PositionDataFrame(coord=xy, run = "binary_test"), centroided = T) image(cdata, mz=1)
returns a plot with an error:
Error in image.default(1, vals, t(as.matrix(vals)), col = col, xaxt = "n", : increasing 'x' and 'y' values expected
Minimal working example...
xy <- expand.grid(x=c(1:5),y=c(1:5)) ms_data_rand <- matrix(rnorm(nrow(xy),mean=0,sd=1), ncol=nrow(xy),nrow=1) cdata_randint <- MSImagingExperiment( imageData = ms_data_rand, featureData = MassDataFrame(mz = 1), pixelData = PositionDataFrame(coord=xy, run = "rand_test"), centroided = T) image(cdata_randint, mz=1)
No error here.
> sessionInfo() R version 4.0.0 (2020-04-24) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets methods [9] base other attached packages: [1] Cardinal_2.6.0 ProtGenerics_1.20.0 S4Vectors_0.26.1 EBImage_4.30.0 [5] BiocParallel_1.22.0 BiocGenerics_0.34.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.4.6 compiler_4.0.0 pillar_1.4.4 matter_1.14.0 [5] bitops_1.0-6 tools_4.0.0 mclust_5.4.6 digest_0.6.25 [9] viridisLite_0.3.0 lifecycle_0.2.0 tibble_3.0.1 nlme_3.1-147 [13] lattice_0.20-41 pkgconfig_2.0.3 png_0.1-7 rlang_0.4.6 [17] Matrix_1.2-18 DBI_1.1.0 biglm_0.9-2 dplyr_1.0.0 [21] generics_0.0.2 fftwtools_0.9-8 htmlwidgets_1.5.1 vctrs_0.3.0 [25] locfit_1.5-9.4 grid_4.0.0 tidyselect_1.1.0 glue_1.4.1 [29] Biobase_2.48.0 R6_2.4.1 jpeg_0.1-8.1 sp_1.4-2 [33] irlba_2.3.3 purrr_0.3.4 magrittr_1.5 MASS_7.3-51.6 [37] htmltools_0.4.0 ellipsis_0.3.1 abind_1.4-5 tiff_0.1-5 [41] signal_0.7-6 RCurl_1.98-1.2 crayon_1.3.4
I was recently plotting some binary masks and found this potential bug when plotting a binary mask where all values are equal. Seems to be more related to
image.default
thanCardinal
itself but it could be an issue for someone else at some point.Minimal reproducible example...
returns a plot with an error:
Minimal working example...
No error here.