如何使用 sjPlot plot_model 与多个主持人或交互更改方面选项
How to change facet options with sjPlot plot_model with multiple moderators or interactions
我有一个情节,我想在其中展示三个术语在三个不同的分类子组之间如何相关的模型。 sjPlot::plot_model
自动创建一种在一行中包含三个图的分面。一般来说,这很有效。然而,对于演示文稿,我有一些其他的图,它们有四个子组,并且以两乘二的网格绘制。因此 y-axis 没有太大区别,我想将 1x3 分面更改为 2x2 分面,其中一行有两个图,第二行有一个图。我尝试添加 + facet_wrap()
但没有成功。谁能建议一种将 1x3 plot_model
object 转换为 2x1/1x1 图的方法?理想情况下,仍然只有一个 x-axis 标题、一个 y-axis 标题和一个图例。
# example of 1x3 plot_model output
mtcars %>%
mutate(cyl_fct = as.factor(cyl)) %>%
lm(mpg ~ wt * vs * cyl_fct, data = .) %>%
plot_model(type = "pred", terms = c("wt", "vs", "cyl_fct"))
更改绘图对象内小平面部分的 nrow
参数。
x=mtcars %>%
mutate(cyl_fct = as.factor(cyl)) %>%
lm(mpg ~ wt * vs * cyl_fct, data = .) %>%
plot_model(type = "pred", terms = c("wt", "vs", "cyl_fct"))
x$facet$params$nrow=2
x
我有一个情节,我想在其中展示三个术语在三个不同的分类子组之间如何相关的模型。 sjPlot::plot_model
自动创建一种在一行中包含三个图的分面。一般来说,这很有效。然而,对于演示文稿,我有一些其他的图,它们有四个子组,并且以两乘二的网格绘制。因此 y-axis 没有太大区别,我想将 1x3 分面更改为 2x2 分面,其中一行有两个图,第二行有一个图。我尝试添加 + facet_wrap()
但没有成功。谁能建议一种将 1x3 plot_model
object 转换为 2x1/1x1 图的方法?理想情况下,仍然只有一个 x-axis 标题、一个 y-axis 标题和一个图例。
# example of 1x3 plot_model output
mtcars %>%
mutate(cyl_fct = as.factor(cyl)) %>%
lm(mpg ~ wt * vs * cyl_fct, data = .) %>%
plot_model(type = "pred", terms = c("wt", "vs", "cyl_fct"))
更改绘图对象内小平面部分的 nrow
参数。
x=mtcars %>%
mutate(cyl_fct = as.factor(cyl)) %>%
lm(mpg ~ wt * vs * cyl_fct, data = .) %>%
plot_model(type = "pred", terms = c("wt", "vs", "cyl_fct"))
x$facet$params$nrow=2
x