Specify the height and width of the ggplot plot in the output of Rmarkdown knitr

I created a graph with ggplot2, where the X axis labels are not readable if the graph is larger than the default. When viewing in Rstudio I can dynamically resize. When saving with ggsave (), I can specify the height and width. How do I do this in an Rmarkdown file so that the output contains a graph of the desired size?

+4
source share
1 answer

You can specify height and width in code snippets

```{r, fig.width=10,fig.height=11}
df %>% ggplot(aes(x = x, y = y)) + geom_point()
```
+23
source

Source: https://habr.com/ru/post/1655440/


All Articles