R: fig.width is ignored when using ggcorrplot within Quarto for generating an HTML document.
Any ideas why?
---
format: html
page-layout: full
embed-resources: true
code-fold: true
execute:
warning: false
message: false
---
```{r, fig.width = 20}
# fig.width working
ggplot(airquality, aes(Temp, Ozone)) +
geom_point() +
geom_smooth(method = "loess", se = FALSE)
# fig.width not working
airquality %>%
cor(use = "pair") %>%
ggcorrplot()
```
It looks like ggcorrplot
has a fixed height/width ratio, so you could specify the fig-height
per below (or fig-asp
):
---
format: html
page-layout: full
embed-resources: true
code-fold: true
execute:
warning: false
message: false
---
```{r}
#| fig-width: 20
library(ggplot2)
library(ggcorrplot)
ggplot(airquality, aes(Temp, Ozone)) +
geom_point() +
geom_smooth(method = "loess", se = FALSE)
```
```{r}
#| fig-width: 20
#| fig-height: 20
airquality |>
cor(use = "pair") |>
ggcorrplot(ggtheme = theme_classic)
```
Side-by-side is also an option for a smaller ggcorrplot
:
::: {layout="[3,1]"}
```{r}
#| fig-width: 20
library(ggplot2)
library(ggcorrplot)
ggplot(airquality, aes(Temp, Ozone)) +
geom_point() +
geom_smooth(method = "loess", se = FALSE)
```
```{r}
#| fig-width: 20
#| fig-height: 20
airquality |>
cor(use = "pair") |>
ggcorrplot(ggtheme = theme_classic)
```
:::