当 plotly bar chart textposition = "inside" 时,如何移动条内的文本?

When plotly bar chart textposition = "inside", how do I shift the text inside the bar?

代码:

library(plotly)
library(dplyr)

xValues <- c("drug1","drug2","drug3","drug4","drug5")

yValues <- c(5,10,15,20,25)

bar <- plot_ly(x = yValues,
               y = xValues,
               type = 'bar',
               orientation = 'h',
               text = xValues,
               textposition = "inside",
               insidetextanchor = "middle",
               insidetextfont = list(color = '#000000'),
               showlegend = F) %>% 
         layout(
                xaxis = list(title = "Studies"),
                yaxis = list(zeroline = FALSE,showline = FALSE,showticklabels = FALSE))
bar

输出: bar chart

当我尝试将 insidetextanchor 与 plot_ly() 一起使用时,它没有记录我要求它将文本移动到中间。我做错了什么?


根据 Figure Reference for Plotly R(条形轨迹部分):

insidetextanchor

类型:枚举,("end" | "middle" | "start" 之一) 默认: "end"

确定文本是否保持在中心或 start/end 点 textposition "inside" 模式。

当我运行这段代码文本按预期出现在中间。更新包和 R