r - 如何在plotly R中的绘图上添加文本框?

标签 r textbox plotly

我想在用plotly生成的图上添加一个文本框或信息文本。 现在看来是这样。 without text

我想用文本框制作如下(不需要圈出:)))。

with text-box

到目前为止的代码:

p <- plot_ly(data=data.mosann, x = ~Combined, y = ~Actual)%>%
  layout(shapes=list(type='line', x0= 0, x1= 235, y0=0, y1=235, line=list(color='red',width=3)),
         title = 'Scatter Plot Measurements-Combined Improvements MinT',
         xaxis = list(title = "Combined MinT", showgrid = TRUE),
         yaxis = list(title = "Measurements", showgrid = TRUE))
p

最佳答案

试试这个。根据您想要文本的位置更改布局注释的 xy

p <- plot_ly(data=data.mosann, x = ~Combined, y = ~Actual)%>%
  layout(xaxis = ~Combined, yaxis = ~Actual, 
         annotations = list(text = "YOUR TEXT HERE",  x = 200, y = 30,showarrow=FALSE ),
         shapes=list(type='line', x0= 0, x1= 235, y0=0, y1=235, line=list(color='red',width=3)),
         title = 'Scatter Plot Measurements-Combined Improvements MinT',
         xaxis = list(title = "Combined MinT", showgrid = TRUE),
         yaxis = list(title = "Measurements", showgrid = TRUE))  

关于r - 如何在plotly R中的绘图上添加文本框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47299176/

相关文章:

.NET - WinForm 文本框 - Focus 和 SelectedText

c# - 从两个文本框中添加值并在第三个文本框中显示总和

python - 自定义悬停以按颜色显示散点图

r - 为字符串分配一个值

r - knitr 中的数字标题和标签

r - 从 R 中的向量元素创建数字序列列表

R - 提高采样功能速度

c# - 样式 asp 文本框与 css 3 如何正确声明输入

python - 如何使用 Python 和 Plotly 创建不显示异常值的箱线图?

r - 使用 facet_wrap 和 ggplotly 的第一个和最后一个方面比中间方面大