-
DescriptionI'm trying to stack two figures on top of each other. Here's the code:
However, they're displayed side-by-side. Is that intentional? If so, any way to override this behaviour? I tried with the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
As a workaround, using We should document this better, and possibly change our algorithm; I agree with you that this is confusing. |
Beta Was this translation helpful? Give feedback.
-
@cscheid it could just be a matter of processing or CSS because it does end up as two rows when a label is added to the chunk ---
format: html
---
```{r}
#| echo: false
#| label: fig-p1
#| layout-nrow: 2
#| fig-cap: "Caption."
#| fig-subcap:
#| - "Subcaption 1."
#| - "Subcaption 2."
#| fig-align: center
library(ggplot2)
p1 <- ggplot() +
geom_point(data = mtcars, aes(x = wt, y = mpg))
p1
p1
``` Removing the label will lead to two column and one row. I guess the two processing should have lead to same layout. Maybe that is what you meant above though. |
Beta Was this translation helpful? Give feedback.
As a workaround, using
layout-ncol: 1
solves the issue for me in your document. I think our logic forlayout-nrow
andlayout-ncol
is "at most n columns or rows", and not "try to do exactly n rows or cols".We should document this better, and possibly change our algorithm; I agree with you that this is confusing.