【问题标题】:how to add a text label in the y-axis in ggplot2如何在ggplot2的y轴上添加文本标签
【发布时间】:2016-05-23 03:26:27
【问题描述】:

我想将单个文本标签添加到 y 轴的指定点(称为 y = 1.5)。这将在其中以及常规滴答声中。

在 ggplot2 包中是否有这样做的好方法?

【问题讨论】:

  • 使用scale_y_continuous 中的breaks 参数来指定轴技巧必须在什么时候出现。

标签: r ggplot2 axis-labels


【解决方案1】:

是的!来自ggplot2 documentation

# Add a text annotation
p +
  geom_text() +
  annotate("text", label = "plot mpg vs. wt", x = 2, y = 15, size = 8, colour = "red")


(来源:ggplot2.org

你的看起来像+ annotate("text", label = "your text here", x = 2, y = 1.5)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-04
    • 1970-01-01
    相关资源
    最近更新 更多