Giuseppe Pagnoni
2013-Aug-22 15:08 UTC
[R] corrgram (package corrgram): how to plot multiple correlograms in the same page?
Hello, I am trying to plot a few correlograms on the same figure, with the function corrgram() from the package corrgram. However, the function does not seem to use the base graphic system, as setting out the multiple figure layout with, e.g., par(mfrow=c(2, 2,)) does not work. Does anybody know a workaround for this? Many thanks in advance for any advice best giuseppe -- Giuseppe Pagnoni, PhD Dip. Scienze Biomediche, Metaboliche e Neuroscienze Sezione Fisiologia e Neuroscienze Univ. di Modena e Reggio Emilia Via Campi 287 I-41125 Modena, Italy Tel: +39-059-205-5742 Fax: +39-059-205-5363 [[alternative HTML version deleted]]
Kevin Wright
2013-Aug-22 18:26 UTC
[R] corrgram (package corrgram): how to plot multiple correlograms in the same page?
When you are using a package from CRAN, you should probably contact the author of the package (in this case, that is me) with questions, instead of asking on R-help. The corrgram package DOES use base graphics. For instance, when using 3 variables, each one of the squares of the corrgram is using one 'plot' of par(mfrow=c(3,3)). What you are trying to achieve may theoretically be possible using the gridBase package, though I have not been able to construct a working example, perhaps because corrgram() changes par() inside of the function. Here's an example that works for simple scatterplots. require(grid) require(gridBase) gl <- grid.layout(2, 2, widths=unit(c(3, 3), "inches"), heights=unit(c(3, 3), "inches")) pushViewport(viewport(layout=gl)) grid.newpage() unit. <- unit(c(1,1), c('null','null')) pushViewport(viewport(layout=gl)) for(i in 1:2) { for(j in 1:2) { pushViewport(viewport(layout.pos.row=i, layout.pos.col=j)) par(fig=gridFIG()) par(new=TRUE) grid.rect(gp=gpar(lwd=3, col=i+j)) plot(1:10) #corrgram(dat) # not working... popViewport() } } Kevin On Thu, Aug 22, 2013 at 10:08 AM, Giuseppe Pagnoni <gpagnoni@gmail.com>wrote:> Hello, > > I am trying to plot a few correlograms on the same figure, with the > function corrgram() from the package corrgram. However, the function does > not seem to use the base graphic system, as setting out the multiple figure > layout with, e.g., par(mfrow=c(2, 2,)) does not work. > > Does anybody know a workaround for this? > > Many thanks in advance for any advice > > best > giuseppe > -- > Giuseppe Pagnoni, PhD > Dip. Scienze Biomediche, Metaboliche e Neuroscienze > Sezione Fisiologia e Neuroscienze > Univ. di Modena e Reggio Emilia > Via Campi 287 > I-41125 Modena, Italy > Tel: +39-059-205-5742 > Fax: +39-059-205-5363 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Kevin Wright [[alternative HTML version deleted]]
Maybe Matching Threads
- Repeated-measures anova with a within-subject covariate (or varying slopes random-effects?)
- Function nlme::lme in Ubuntu (but not Win or OS X): "Non-positive definite approximate variance-covariance"
- Correlograms: using boxes and different variables on rows and columns
- corrgram
- problem with corrgram function