相关疑难解决方法(0)

使 plotly 注释字体加粗

我想添加annotationscatterR'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 在我的真实数据中,我想注释点簇,因此注释作为一个单独的层出现。

fonts r plotly

4
推荐指数
1
解决办法
8071
查看次数

标签 统计

fonts ×1

plotly ×1

r ×1