我的例子是:
qplot(mtcars$mpg) + annotate(geom = "text", x = 30, y = 3, label = "Some text\nSome more text")
Run Code Online (Sandbox Code Playgroud)
如何让这里的文字保持对齐?所以'有些人相互排队.
我正在尝试旋转 R 中 ggplot 上的注释,类似于此问题,但使用带有背景的标签几何图形。
geom = "text"使用与或geom_text一起使用geom = 'label'的代码geom_label会导致注释不旋转。
fake = data.frame(x=rnorm(100), y=rnorm(100))
ggplot(data = fake, aes(x = x, y = y)) +
geom_point() +
geom_vline(xintercept = -1, linetype = 2, color = "red") +
# annotate(geom = "text", x = -1, y = -1, label = "Helpful annotation", color = "red",
# angle = 90)
annotate(geom = "label", x = -1, y = -1, label = "Helpful annotation", color …Run Code Online (Sandbox Code Playgroud)