如何编辑plot_models函数以具有“ free_x”比例?

我正在尝试使用sjPlot包中的plot_models函数来绘制估算值,但是我想为我的方面提供free_x。我尝试将plot_models函数中的代码编辑为p + facet_grid(~group,scales = "free_x"),但是出现以下错误:

Error: Column 6 must be named.
Use .name_repair to specify repair.
Call `rlang::last_error()` to see a backtrace 

代码:

library(sjPlot)
data(efc)

# fit three models
fit1 <- lm(barthtot ~ c160age + c12hour + c161sex + c172code,data = efc)
fit2 <- lm(neg_c_7 ~ c160age + c12hour + c161sex + c172code,data = efc)
fit3 <- lm(tot_sc_e ~ c160age + c12hour + c161sex + c172code,data = efc)

mod.plot <-  plot_models(fit1,fit2,fit3,grid = TRUE)
mod.plot

是否可以为scale = free_x设置mod.plot

queencce 回答:如何编辑plot_models函数以具有“ free_x”比例?

我不知道sjPlot包或plot_models函数,但是在我看来,他们好像硬编码了x轴限制(实际上是y轴,因为他们使用了{{1 }})。如果您可以接受有关覆盖比例的警告,则可以执行以下操作:

coord_flip()

enter image description here

本文链接:https://www.f2er.com/3148714.html

大家都在问