I try to add an Asterix footnote in the chart plotted with Plotly. This is my chart and below you can see how it look like
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 say: Note: * The tallest animal
.
So can anybody help me how to solve this problem?
CodePudding user response:
You can use layout(annotations)
to add "caption" to 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')
)