Patchwork未正确遵循布局。

huangapple go评论60阅读模式
英文:

Patchwork not following layout correctly

问题

I want four equally sized panels on the second row of my plot but the output is not matching the layout I specify.

library(ggplot2)
library(patchwork)

set seed(1)
df <- data.frame(x = rnorm(10), y = rnorm(10))
p <- ggplot(df, aes(x = x, y = y)) +
  geom_point()

layout <- "
AAABBBBB
CCDDEEFF
"

p + p + p + p + p + p + plot_layout(design = layout)
英文:

I want four equally sized panels on the second row of my plot but the output is not matching the layout I specify.

library(ggplot2)
library(patchwork)

set.seed(1)
df&lt;-data.frame(x=rnorm(10),y=rnorm(10))
p &lt;- ggplot(df, aes(x=x,y=y)) +
  geom_point()

layout &lt;- &quot;
AAABBBBB
CCDDEEFF
&quot;

p + p + p + p + p + p + plot_layout(design = layout)

Patchwork未正确遵循布局。

答案1

得分: 3

这将产生正确的输出(改编自这里

(p + p + plot_layout(widths = c(3,5))) /
  (p + p + p +p + plot_layout(widths = c(2,2,2,2)))
英文:

This will produce the correct output (adapted from here)

(p + p + plot_layout(widths = c(3,5))) /
  (p + p + p +p + plot_layout(widths = c(2,2,2,2)))

答案2

得分: 1

Using different layout design per row:

(p + p + plot_layout(design = "AAABBBBB")) /
(p + p + p + p + plot_layout(design = "CCDDEEFF"))

Patchwork未正确遵循布局。

英文:

Using different layout design per row:

(p + p + plot_layout(design = &quot;AAABBBBB&quot;)) /
  (p + p + p + p + plot_layout(design = &quot;CCDDEEFF&quot;))

Patchwork未正确遵循布局。

huangapple
  • 本文由 发表于 2023年6月13日 18:17:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463869.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定