如何在R中将x轴刻度从数字更改为单词
我有以下代码:
library(sjPlot)
v1 <- rbinom(100, size=1, p=0.5)
v2 <- rnorm(1:100)
v3 <- rnorm(1:100)
v4<- rbinom(100, size=1, p=0.5)
mydf<- data.frame(v1, v2, v3, v4)
mydf$v4 <- as.factor(mydf$v4)
mydf$v1 <- as.factor(mydf$v1)
mylogit <- glm(v1 ~ v2 + v3 + v4 )
mylogit
sjPlot::plot_model(mylogit, type = "eff", terms = "v4") +
ggtitle("Country") + theme_set(theme_bw())+
ylab("") +
xlab("")
我想要做的是将 x 轴中的 1 和 0 替换为“pre”和“post”。我用了一些方法来改变它们,但它们对我不起作用。
I have the following code:
library(sjPlot)
v1 <- rbinom(100, size=1, p=0.5)
v2 <- rnorm(1:100)
v3 <- rnorm(1:100)
v4<- rbinom(100, size=1, p=0.5)
mydf<- data.frame(v1, v2, v3, v4)
mydf$v4 <- as.factor(mydf$v4)
mydf$v1 <- as.factor(mydf$v1)
mylogit <- glm(v1 ~ v2 + v3 + v4 )
mylogit
sjPlot::plot_model(mylogit, type = "eff", terms = "v4") +
ggtitle("Country") + theme_set(theme_bw())+
ylab("") +
xlab("")
What I want to do is to replace 1 and 0 in my x-axis with "pre" and "post." I used a few methods to change them but they never worked for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样:
How about this: