我想添加annotation到scatter由R'splotly包生成的绘图中,并以粗体显示文本。
我想:
library(plotly)
library(dplyr)
set.seed(1)
df <- data.frame(x=rnorm(10),y=rnorm(10))
plotly::plot_ly(x =~ df$x, y =~ df$y,marker = list(size=12), type = 'scatter',mode = "markers") %>%
plotly::add_annotations(text=1:10,showarrow=T,arrowhead=1,x=df$x,y=df$y,font=list(size=10))
Run Code Online (Sandbox Code Playgroud)
试图添加face="bold"到font规范list:
plotly::plot_ly(x =~ df$x, y =~ df$y,marker = list(size=12), type = 'scatter',mode = "markers") %>%
plotly::add_annotations(text=1:10,showarrow=T,arrowhead=1,x=df$x,y=df$y,font=list(size=10,face="bold"))
Run Code Online (Sandbox Code Playgroud)
所以问题是如何让该文本注释以粗体显示。
PS 在我的真实数据中,我想注释点簇,因此注释作为一个单独的层出现。