I'm trying to add an asterisk footnote to a chart plotted with Plotly. This is my code:
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
.
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')
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.