[英]Adding footnote in Plotly
I'm trying to add an asterisk footnote to a chart plotted with Plotly. This is my code:我正在尝试向使用 Plotly 绘制的图表添加星号脚注。这是我的代码:
library(plotly)
fig <- plot_ly(
x = c("giraffes", "orangutans", "monkeys"),
y = c(20, 14, 23),
name = "SF Zoo",
type = "bar"
)
fig
Now I want to put an asterisk on "giraffes*" and after that give some additional explanation below this bar plot, let's say: Note: * The tallest animal
.现在我想在“长颈鹿*”上加一个星号,然后在这个栏 plot 下面给出一些额外的解释,比方说:
Note: * The tallest animal
。
You can use layout(annotations)
to add "caption" to Plotly
.您可以使用
layout(annotations)
将“标题”添加到Plotly
。
library(plotly)
plot_ly(
x = c("giraffes*", "orangutans", "monkeys"),
y = c(20, 14, 23),
name = "SF Zoo",
type = "bar"
) |>
layout(annotations =
list(x = 0, y = -0.1,
text = "Note: * The tallest animal.",
showarrow = F,
xref='paper',
yref='paper')
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.