-1

I am using base R plot function to generate vertically aligned plots (2-by-1), with both x and y labels but without a title. However, when I use

par(mfrow=c(2,1))
plot(obj1)
plot(obj2)

I notice that the blank margin area between the two plots is so huge (I assume R does not exclude the area for the main= title...). Is there a way to make the two plots more "closer" to each other, while keep the x-labels at appropriate locations?

BTW, is there a way to generate a plot in PDF format without any useless blank margins? I plan to include the figure in the paper manuscript, and I don't want to see such margins occupying. Thanks!

4
  • @joran: thanks, but how can I address the first question, i.e. the blank margin between the two plots that aligned vertically?
    – alittleboy
    May 3, 2013 at 18:33
  • By adjusting the margins, as indicated in the question I linked to. Have you read it or tried it yet?
    – joran
    May 3, 2013 at 18:35
  • @joran: yes, thanks for the post. I tried to control the outer margin, but still cannot figure out how to control the area between the two vertical plots...
    – alittleboy
    May 3, 2013 at 18:41
  • I'm not sure how else to say it. You adjust the margins by setting par(mar = ...) as needed. Edit your question to include exactly what you tried.
    – joran
    May 3, 2013 at 18:44

1 Answer 1

0

As described in the (duplicate) question I linked to, the solution is exactly the same as there:

par(mfrow=c(2,1))
par(mar = c(0,4,4,2) + 0.1)
plot(1:5)
par(mar = c(5,4,0,2) + 0.1)
plot(1:5)

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.