R 在绘图仪图表中添加悬停文字或文字注释
我们可以在R 在绘图仪图表中添加悬停文字或文字注释,r,plotly,gauge,R,Plotly,Gauge,我们可以在曲线图中添加悬停文字或文字注释吗?例如,在我下面的图中,我想在绿色区域中添加悬停或文本,或同时在灰色区域中添加“摄入第一剂量%:19.8”,以及在灰色区域中添加“未接种(%):80.2” library(plotly) 无花果 library(plotly) fig <- plot_ly( type = "indicator", mode = "gauge+number+delta", value = 19.8, titl
曲线图中添加悬停文字或文字注释吗?例如,在我下面的图中,我想在绿色区域中添加悬停或文本,或同时在灰色区域中添加“摄入第一剂量%:19.8”
,以及在灰色区域中添加“未接种(%):80.2”
library(plotly)
无花果
library(plotly)
fig <- plot_ly(
type = "indicator",
mode = "gauge+number+delta",
value = 19.8,
title = list(text = "Uptake first dose %", font = list(size = 24)),
delta = list(reference = 70, increasing = list(color = "gray")),
gauge = list(
axis = list(range = list(NULL, 100), tickwidth = 1, tickcolor = "lightgreen"),
bar = list(color = "lightgreen"),
bgcolor = "white",
borderwidth = 2,
bordercolor = "gray",
steps = list(
list(range = c(0, 50), color = "lightgreen"),
list(range = c(20, 100), color = "gray")),
threshold = list(
line = list(color = "black", width = 4),
thickness = 0.75,
value = 70)))
fig <- fig %>%
layout(
margin = list(l=20,r=30),
paper_bgcolor = "lavender",
font = list(color = "darkblue", family = "Arial"))
fig