【问题标题】:Alternative for geom_label in ggplotlyggplotly 中 geom_label 的替代方案
【发布时间】:2021-09-16 21:28:04
【问题描述】:

我想在 ggplotly 图中使用 geom_label 的“填充”功能。不幸的是,ggplotly 不支持 geom_label。相反,我正在使用 geom_text 但你不能在这里使用“填充”。有没有如下图所示的如何在没有 geom_label 的情况下在文本周围获得背景的替代方法?

【问题讨论】:

  • 如果要使用ggplotly,请考虑tooltip参数

标签: r ggplot2 plotly ggplotly


【解决方案1】:
ggplotly(ggplot(mtcars, aes(x=wt, y=mpg, text=rownames(mtcars))) + geom_point(), tooltip = "text")

【讨论】:

  • 您好,tooltip 和 geom_label 是有区别的。我不想只在鼠标悬停上贴标签。不过还是谢谢你!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-06-13
  • 2015-03-03
  • 2015-09-25
  • 2019-12-16
  • 2011-06-20
  • 2015-11-03
  • 2014-04-03
相关资源
最近更新 更多