I am working with Plotly. I have a double asterisk under this bar chart. Below you can see code and chart
library(plotly)
library(reshape2)
library(dplyr)
plot_ly(
x = c("giraffes*", "whale**", "monkeys"),
y = c(20, 14, 23),
name = "SF Zoo",
type = "bar"
) |>
layout(annotations =
list(x = 0, y =-0.131,
text = "Note: * The tallest animal,Unsurprisingly, the giraffe is the world's tallest living animal by standing height. Male giraffes can measure up to 6 meters or almost 20 feet, but with a height of up to 5.2 meters or 17 feet \n Note: ** Тhe longest animal" ,
showarrow = F,
xref='paper',
yref='paper')
)
In the above pic, you can see that the second note has center alignment
. So I want to change this with left alignment
. So can anybody help me how to solve this problem ?
CodePudding user response:
You can set align
in your annotations
like this:
library(plotly)
library(reshape2)
library(dplyr)
plot_ly(
x = c("giraffes*", "whale**", "monkeys"),
y = c(20, 14, 23),
name = "SF Zoo",
type = "bar"
) |>
layout(annotations =
list(x = 0, y =-0.131,
text = "Note: * The tallest animal,Unsurprisingly, the giraffe is the world's tallest living animal by standing height. Male giraffes can measure up to 6 meters or almost 20 feet, but with a height of up to 5.2 meters or 17 feet \n Note: ** Тhe longest animal" ,
showarrow = F,
xref='paper',
yref='paper',
align = "left")
)
Output: