我正在使用该interactions包根据回归绘制交互图。
figure6 <- interact_plot(sitc0.logit, pred = lnlaggdpp,
modx = inter_industry, interval = TRUE) +
scale_x_continuous(name = "Economic Size (ln GDP)", breaks=seq(4,16.1,1)) +
scale_y_continuous(name = "Probability of sanctions busting", breaks=seq(0,.5,.025)) +
theme(legend.title = element_blank()) +
labs(title="Marginal Effects of Intra- and Inter-Industry Trade, Agricultural Goods") +
geom_line(aes(colour = inter_industry))
Run Code Online (Sandbox Code Playgroud)
这是我运行上面的代码时得到的结果:
在过去的几个小时里,我一直试图让图例正确显示。“0”和“1”是称为 的因子变量的值inter_industry。我不想将级别显示为数字,而是希望在有“0”的地方显示“行业间”,在有“1”的地方显示“行业内”。
我觉得这一定是一个简单的解决办法,但我一生都无法让它发挥作用!我要制作 9 个这样的图表,所以如果我能正确显示它们就好了。预先感谢您的任何帮助!
添加
scale_fill_discrete(name = "", labels = c("Inter-Industry", "Intra-Industry"))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
678 次 |
| 最近记录: |