wilkelab / cowplot

cowplot: Streamlined Plot Theme and Plot Annotations for ggplot2
https://wilkelab.org/cowplot/
701 stars 84 forks source link

Cannot convert object of class LayerInstanceLayerggprotogg into a grob? #182

Closed marwa38 closed 2 years ago

marwa38 commented 2 years ago

Hello

I am importing those 2 plots into R so that I can plot_grid() them together in one figure. lefseConda_barPlot lefseConda_cladogram

my codes are as follows

p1 <- draw_image("tables/lefseConda_barPlot.png")
p2 <- draw_image("tables/lefseConda_cladogram.png")
plot_grid(p1,
          p2,
          labels = c("A", "B"),
          label_size = 12)

and I am getting this warning and I blank figure (attached)

Warning messages:
1: In as_grob.default(plot) :
  Cannot convert object of class LayerInstanceLayerggprotogg into a grob.
2: In as_grob.default(plot) :
  Cannot convert object of class LayerInstanceLayerggprotogg into a grob.

image

# R version 4.1.0 (2021-05-18)
# Platform: x86_64-conda-linux-gnu (64-bit)
# Running under: Ubuntu 20.04.4 LTS
# 
# Matrix products: default
# BLAS/LAPACK: /home/r01mt19/.conda/envs/updatedR/lib/libopenblasp-r0.3.18.so
# 
# locale:
#   [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
# [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
# [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
# 
# attached base packages:
#   [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
#   [1] magick_2.7.3           forcats_0.5.1          stringr_1.4.0          dplyr_1.0.7           
# [5] purrr_0.3.4            readr_2.1.1            tidyr_1.1.4            tibble_3.1.6          
# [9] ggplot2_3.3.5          tidyverse_1.3.1        cowplot_1.1.1          microbiomeMarker_1.0.2
# 
# loaded via a namespace (and not attached):
#   [1] readxl_1.3.1                backports_1.4.1             circlize_0.4.14            
# [4] plyr_1.8.6                  igraph_1.2.10               lazyeval_0.2.2             
# [7] splines_4.1.0               BiocParallel_1.26.0         GenomeInfoDb_1.28.0        
# [10] digest_0.6.29               foreach_1.5.1               yulab.utils_0.0.4          
# [13] fansi_0.4.2                 magrittr_2.0.1              memoise_2.0.1              
# [16] cluster_2.1.2               doParallel_1.0.17           tzdb_0.2.0                 
# [19] limma_3.50.0                ComplexHeatmap_2.10.0       Biostrings_2.60.0          
# [22] annotate_1.70.0             modelr_0.1.8                RcppParallel_5.1.5         
# [25] matrixStats_0.61.0          metagenomeSeq_1.36.0        jpeg_0.1-9                 
# [28] colorspace_2.0-2            rvest_1.0.2                 blob_1.2.2                 
# [31] haven_2.4.3                 rbibutils_2.2.7             crayon_1.4.2               
# [34] RCurl_1.98-1.5              jsonlite_1.7.2              genefilter_1.74.0          
# [37] dada2_1.20.0                survival_3.2-13             iterators_1.0.13           
# [40] ape_5.6                     glue_1.6.0                  gtable_0.3.0               
# [43] zlibbioc_1.38.0             XVector_0.32.0              GetoptLong_1.0.5           
# [46] DelayedArray_0.18.0         phyloseq_1.36.0             Rhdf5lib_1.14.0            
# [49] shape_1.4.6                 BiocGenerics_0.38.0         scales_1.1.1               
# [52] DBI_1.1.2                   Rcpp_1.0.7                  plotROC_2.2.1              
# [55] xtable_1.8-4                clue_0.3-60                 gridGraphics_0.5-1         
# [58] tidytree_0.3.9              bit_4.0.4                   stats4_4.1.0               
# [61] glmnet_4.1-2                httr_1.4.2                  gplots_3.1.1               
# [64] RColorBrewer_1.1-2          ellipsis_0.3.2              farver_2.1.0               
# [67] pkgconfig_2.0.3             XML_3.99-0.8                dbplyr_2.1.1               
# [70] locfit_1.5-9.4              utf8_1.2.2                  labeling_0.4.2             
# [73] ggplotify_0.1.0             tidyselect_1.1.1            rlang_0.4.12               
# [76] reshape2_1.4.4              AnnotationDbi_1.54.0        cellranger_1.1.0           
# [79] munsell_0.5.0               tools_4.1.0                 cachem_1.0.6               
# [82] cli_3.1.0                   generics_0.1.1              RSQLite_2.2.8              
# [85] ade4_1.7-18                 broom_0.7.11                biomformat_1.20.0          
# [88] fastmap_1.1.0               yaml_2.2.1                  ggtree_3.2.1               
# [91] fs_1.5.2                    bit64_4.0.5                 caTools_1.18.2             
# [94] KEGGREST_1.32.0