1

Thanks to this question I know how to align plots of same width next to each other, but I would like to have my first plot much wider than the second one (same height though, and the second plot needs to be square).

This post game me an idea to play with plot layout. So here is my code:

\documentclass{article}
\begin{document}

Side by side images:

\begin{figure}[htpb]
<<test, echo=FALSE, out.width='1\\linewidth'>>=
par(mar=c(2,2,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3)
layout(t(matrix(c(1,2))), widths=c(10,2), heights=c(2,2), TRUE)
plot(1:100)
plot(1:10)
@
\end{figure}
Ta da!
\end{document}

And here is the pdf I get:

enter image description here

So if it's the right approach, how can I get rid of the space at the top and the bottom? And if it's not, what the right one?

Thanks in advance.

Community
  • 1
  • 1
dariaa
  • 6,285
  • 4
  • 42
  • 58
  • you just need to adjust the widths and heights maybe `layout(t(matrix(c(1,2))), widths=c(8,2), heights=4, TRUE)` – rawr Nov 23 '14 at 18:05
  • @rawr Thanks for your comment, I forgot to mention that I need my second plot to be square. I did try to play with widths and heights, but I always get this extra space at the top and the bottom. – dariaa Nov 23 '14 at 18:30

1 Answers1

2
fig.width=8, fig.height=2

should work. I usually avoid out.width altogether.

baptiste
  • 75,767
  • 19
  • 198
  • 294