I tried to be careful and thorough, to read various things on the net on how to format figures in R Markdown. They are plotted correctly, but it seems that their size cannot be controlled.
Firstly, there are basics, like:
```{r Fig1, echo=FALSE, fig.height=5, fig.width=15}
x1 = rnorm(100)
x2 = runif(100)
x3 = rbeta(100, 1, 1,)
par(mfrow=c(1,3), mar=c(4,4,4,1), oma=c(0.5,0.5,0.5,0))
qqnorm(x1)
qqnorm(x2)
qqnorm(x3)
```
Then, I try a bit more with:
```{r Fig1b, echo=FALSE, fig.height=5, fig.width=15, out.retina=1}
```
And if I try to match size of another, simple figure, differences are quite visible. For example:
```{r Fig2, echo=FALSE, fig.height=5, fig.width=5, retina=1}
par(mfrow=c(1,1), mar=c(4,4,4,1), oma=c(0.5,0.5,0.5,0))
qqnorm(x1)
```
I wonder what can be done about it -- i.e., how to make all figures equal in size? In particular, if figures such as Fig1 and Fig1b are shrunk, how to adjust the size of simple figure like in Fig2?
Thanks!
It seems to me like you want Fig2 to be the same size as a single panel in Fig1. If you really want them to be the same size, I'd suggest using the same fig.width
and same value for mfrow
.
```{r Fig1, echo=TRUE, fig.height=5, fig.width=15}
x1 = rnorm(100)
x2 = runif(100)
x3 = rbeta(100, 1, 1,)
par(mfrow=c(1,3), mar=c(4,4,4,1), oma=c(0.5,0.5,0.5,0))
qqnorm(x1)
qqnorm(x2)
qqnorm(x3)
```
```{r Fig2, echo=TRUE, fig.height=5, fig.width=15}
par(mfrow=c(1,3), mar=c(4,4,4,1), oma=c(0.5,0.5,0.5,0)) # same, could omit
plot.new() # empty plot
qqnorm(x1)
plot.new() # empty plot
```
And if you mean you want Fig2 to take up the same amount of space on the rendered document as Fig1 then try this where par(op)
resets the plotting parameters.
```{r Fig1, echo=TRUE, fig.height=5, fig.width=15}
x1 = rnorm(100)
x2 = runif(100)
x3 = rbeta(100, 1, 1,)
op <- par(mfrow=c(1,3), mar=c(4,4,4,1), oma=c(0.5,0.5,0.5,0))
qqnorm(x1)
qqnorm(x2)
qqnorm(x3)
par(op)
```
```{r Fig2, echo=TRUE, fig.height=5, fig.width=15}
op <- par(mfrow=c(1,1), mar=c(4,4,4,1), oma=c(0.5,0.5,0.5,0))
qqnorm(x1)
par(op)
```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With