【发布时间】:2020-10-16 21:23:58
【问题描述】:
我有下面的情节代码
ggplot(na.omit(total), aes(x = day_after, y = use, group=t, na.rm=TRUE)) +
geom_line(aes(linetype=t, color=t, na.rm=TRUE))+
geom_point(aes(color=t, na.rm = TRUE)) +
scale_color_manual(values=c("gray48", "indianred4"), labels=c("Treatment","Control")) +
labs(x= "Days after beginning of deactivation period", y= "") +
theme(panel.grid.minor = element_blank(),
panel.background = element_blank()) +
theme(panel.grid.major.x = element_blank(),
panel.grid.major.y = element_line( size=.1, color="grey"))+
theme(legend.key=element_blank()) +
guides(linetype = FALSE) +
annotate('segment',x = 0,xend = 0,y = 0,yend = 60,size = 3,colour = "grey",
alpha = 0.4) +
annotate('segment',x = 7,xend = 7,y = 0,yend = 60,size = 3,colour = "grey",
alpha = 0.4) +
annotate('segment',x = 39,xend = 39,y = 0,yend = 60,size = 3,colour = "grey",
alpha = 0.4)
new_plot <- plot + theme(legend.title=element_blank(), legend.text = element_text(size=10),
legend.position = "right")
我想要做的是在绘图之外的多个给定 (x,y) 值的顶部添加垂直文本。 Annotate_custom 有效,但它没有旋转文本的选项。基本上我试过 + annotation_custom(text_end,xmin=42,xmax=42,ymin=62,ymax=62) 这将是惊人的,只有我不能有像角度 = 90 这样的选项。 有什么帮助吗??
【问题讨论】: