我想在用plotly生成的图上添加一个文本框或信息文本。 现在看来是这样。 without text
我想用文本框制作如下(不需要圈出:)))。
到目前为止的代码:
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
最佳答案
试试这个。根据您想要文本的位置更改布局注释的 x
和 y
。
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/