[英]Plot in R: Gap beginning and end of the x-axis - how to remove?
那是我的代碼
plot_model(mylogit, type = "pred", terms = c("ScoreEnvAtt [all]", "Guilt")) +
scale_colour_discrete(guide = guide_legend(title = "Guilt"), labels = c("Low", "Medium", "High")) +
scale_fill_discrete(guide = guide_legend(title = "Guilt"), labels = c("Low", "Medium", "High")) +
labs( title = "",
x = "Environmental Attitudes",
y = "Probability of choosing the green investment") + theme_gray(base_size = 14) +
theme(text=element_text(family="Times New Roman", size=12))
如何消除兩個間隙,使 x 軸從 3 開始並在 7 結束?
也許通過在 ggplot 中添加以下內容來更改您的比例:
plot_model(mylogit, type = "pred", terms = c("ScoreEnvAtt [all]", "Guilt")) +
scale_colour_discrete(guide = guide_legend(title = "Guilt"), labels = c("Low", "Medium", "High")) +
scale_fill_discrete(guide = guide_legend(title = "Guilt"), labels = c("Low", "Medium", "High")) +
labs( title = "",
x = "Environmental Attitudes",
y = "Probability of choosing the green investment") + theme_gray(base_size = 14) +
theme(text=element_text(family="Times New Roman", size=12)) +
scale_x_continuous(limits = c(3, 7), expand = c(0, 0))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.