我有这样的情节:
fake = data.frame(x=rnorm(100), y=rnorm(100))
ggplot(data=fake, aes(x=x, y=y)) + geom_point() + theme_bw() +
geom_vline(xintercept=-1, linetype=2, color="red") +
annotate("text", x=-1, y=-1, label="Helpful annotation", color="red")
Run Code Online (Sandbox Code Playgroud)

如何将带注释的文本旋转90度,使其与参考线平行?
Gre*_*gor 61
告诉它你想要的角度.
ggplot(data = fake, aes(x = x, y = y)) +
geom_point() +
theme_bw() +
geom_vline(xintercept = -1, linetype = 2, color = "red") +
annotate(geom = "text", x = -1, y = -1, label = "Helpful annotation", color = "red",
angle = 90)
Run Code Online (Sandbox Code Playgroud)
在?geom_text你可以看到,angle是一个可能的审美,而annotate将沿着通过它,就像任何其他的说法geom_text理解(如x,y,label,和color已被使用).
| 归档时间: |
|
| 查看次数: |
26387 次 |
| 最近记录: |