fix the width of the grid in ggplot2
<p><a href="https://i.stack.imgur.com/HQnmS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HQnmS.jpg" alt="enter image description here"></a>I am trying to plot two side by side plots with ggplot. However, as the two data sets contain different number of observations, the width of the grid is automatically adjusted so that the overall width of the two plots is the same. </p>

<p>However, I need to have the same width between each vertical line-segment on the plot and different total widths to reflect the different sample size in the two cases. </p>

<p>Thanks in advance for any advice. </p>

<p>Here is my code</p>

<pre><code>dat1 &lt;- data.frame(a=1:10,b=letters[1:10])
dat2 &lt;- data.frame(a=1:6, b=letters[12:17])

require(gridExtra)
plot1 &lt;- ggplot(dat1, aes(x=b, y=a)) + geom_point(size=4)
plot2 &lt;- ggplot(dat2, aes(x=b, y=a)) + geom_point(size=4)
grid.arrange(plot1, plot2, ncol=2)
</code></pre>