希望有人可以帮助我解决这个问题。我尝试了几种解决方案,但均未成功。
我想复制下图#1。因此,我已将变量时钟(值从 1 到 12)添加到我的数据框中,以将其用作 geom_text 对齐的参数。
图我要复制:
我的图:
按照我的绘图代码:
p1 <- ggplot(data, aes(x=tax, y=employment)) + geom_point(colour = ifelse(style == 1 | style == 2,"black","grey")) + geom_smooth(method=lm, se=FALSE)
p1 + coord_cartesian(xlim = c(0, 0.8), ylim = c(0.5,0.9), expand = FALSE) + labs(x = "1 - participation taxrate", y="Employment rate") + geom_text(aes(family = "Times New Roman", label=ifelse(style == 1 | style == 2 ,Country,''))) + theme_bw()