This is a test version of Biostars. For the public version, visit https://www.biostars.org.
WGCNA of RNA seq data, Error in function plotDendroAndColors

I am using WGCNA package in R (weighted correlation network analysis) I would like to ask about an error in R program: The ERROR:

Error in plot.new() : outer margins too large (figure region too small)

This error occurs when I run the following command:

plotDendroAndColors(geneTree, moduleColorsManual1, groupLabels=("Tree Cut"),
                    dendroLabels = FALSE, hang = 0.03, addGuide = TRUE, guideHang = 0.05,
                    main = "Gene dendrogram and module colors")

I have tried all possible solution such as:

windows()
par("mar")
par(mar=c(1,1,1,1))
par(oma=c(5,7,1,1))
par(mar = rep(2, 4))
graphics.off()
dev.off()
options(jupyter.plot_mimetypes = 'image/png')

but unfortunately I still have the same error.

If any one have any solution for this issue, it will be appreciated

sessionInfo()
R version 3.4.3 (2017-11-30)
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] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] cluster_2.0.7-1       flashClust_1.01-2     WGCNA_1.63            fastcluster_1.1.25   
[5] dynamicTreeCut_1.63-1 edgeR_3.20.9          limma_3.34.9         

loaded via a namespace (and not attached):
 [1] robust_0.4-18         Rcpp_0.12.18          locfit_1.5-9.1        mvtnorm_1.0-8        
 [5] lattice_0.20-35       GO.db_3.5.0           digest_0.6.15         foreach_1.4.4        
 [9] plyr_1.8.4            backports_1.1.2       acepack_1.4.1         pcaPP_1.9-73         
[13] stats4_3.4.3          RSQLite_2.1.1         ggplot2_3.0.0         pillar_1.3.0         
[17] rlang_0.2.2           lazyeval_0.2.1        rstudioapi_0.7        data.table_1.11.4    
[21] blob_1.1.1            S4Vectors_0.16.0      rpart_4.1-13          Matrix_1.2-14        
[25] checkmate_1.8.5       preprocessCore_1.40.0 splines_3.4.3         stringr_1.3.1        
[29] foreign_0.8-71        htmlwidgets_1.2       bit_1.1-14            munsell_0.5.0        
[33] compiler_3.4.3        pkgconfig_2.0.2       BiocGenerics_0.24.0   base64enc_0.1-3      
[37] htmltools_0.3.6       nnet_7.3-12           tibble_1.4.2          gridExtra_2.3        
[41] htmlTable_1.12        Hmisc_4.1-1           IRanges_2.12.0        codetools_0.2-15     
[45] matrixStats_0.54.0    rrcov_1.4-4           crayon_1.3.4          MASS_7.3-50          
[49] grid_3.4.3            gtable_0.2.0          DBI_1.0.0             magrittr_1.5         
[53] scales_1.0.0          stringi_1.1.7         impute_1.52.0         doParallel_1.0.11    
[57] latticeExtra_0.6-28   robustbase_0.93-2     Formula_1.2-3         RColorBrewer_1.1-2   
[61] iterators_1.0.10      tools_3.4.3           bit64_0.9-7           Biobase_2.38.0       
[65] DEoptimR_1.0-8        fit.models_0.5-14     parallel_3.4.3        survival_2.42-6      
[69] AnnotationDbi_1.40.0  colorspace_1.3-2      memoise_1.1.0         knitr_1.20
rna-seq r rna-seq wgcna

just dev.off() until you get error and run your code again

Try saving the figure to file and set the dimensions with, for example:

pdf("figure.pdf", width=12, height=12)
    plotDendroAndColors(geneTree, moduleColorsManual1, groupLabels=("Tree Cut"),
                    dendroLabels = FALSE, hang = 0.03, addGuide = TRUE, guideHang = 0.05,
                    main = "Gene dendrogram and module colors")
dev.off()

The default width and height is just 7 inches for pdf().

You obviously have high density data.

0 answers

No answers yet.

Log in to answer this question.