10

I have this figure:

require(corrplot)
par(oma=c(0,0,2,0), mfrow = c(1, 3))
for (country in c("Italy","Germany","Afghanistan")) {
  corrplot.mixed(cor(data.frame(v1=rnorm(40),
                                v2=rnorm(40),
                                v3=rnorm(40),
                                v4=rnorm(40),
                                v5=rnorm(40),
                                v6=rnorm(40),
                                v7=rnorm(40),
                                v8=rnorm(40)), use="pairwise.complete.obs"),
                 main=country)
}
par(mfrow = c(1, 1))

which produces titles cut in half:

enter image description here

Following this answer I set oma=c(0,0,2,0) but it does't affect the results. I am not sure which margin I should modify. I looked at ?par and modified "oma", "omd", "omi", "mai", "mar" with no result.

Karolis Koncevičius
  • 9,417
  • 9
  • 56
  • 89
CptNemo
  • 6,455
  • 16
  • 58
  • 107
  • It's probably not a base-graphics function. – IRTFM Mar 04 '15 at 06:02
  • 1
    @BondedDust Doesn't sound good. Should I then assign the titles out of `corrplot()`? – CptNemo Mar 04 '15 at 06:04
  • Sorry. It is base graphics, but it's setting its own mar parameters. Look at the code with `corrplot::corrplot`. Why not try printing to a graphics file device and viewing it with an external viewer? Could also try passing the mar arguments inside the `corrplot` call. – IRTFM Mar 04 '15 at 06:21

1 Answers1

19

I found that passing mar arguments to corrplot was effective:

    png(height=300,width=600);par(oma=c(0,0,2,0), mfrow = c(1, 3))
for (country in c("Italy","Germany","Afghanistan")) {
  corrplot.mixed(cor(data.frame(v1=rnorm(40),
                                v2=rnorm(40),
                                v3=rnorm(40),
                                v4=rnorm(40),
                                v5=rnorm(40),
                                v6=rnorm(40),
                                v7=rnorm(40),
                                v8=rnorm(40)), use="pairwise.complete.obs"),
                 main=country, mar=c(0,0,2,0))
};dev.off()

enter image description here

IRTFM
  • 258,963
  • 21
  • 364
  • 487