I have a bar chart that is horizontally oriented and it's flipped (autorange = 'reversed') so its base is on the right side. My problem is that ticktexts for Y-axis stay on the left side, where the Y-axis had been before being flipped. That means ticktexts are not at the base of the chart bars, but at their ends.
How do I change their position and move them to the right?
library(plotly)
my_data <- data.frame(Value = c(3, 6, 7, 4, 9), Type = c("Red", "Orange", "White", "Black", "Green"))
my_chart <- function(my_data){
chart <- plot_ly(my_data) %>%
plotly::add_trace(x = ~Value,
y = ~Type,
name = ~Type,
marker = list(color = "#4369ab"),
type = "bar",
orientation = 'h')
chart %>% layout(yaxis = list(title = ""),
xaxis = list(title = "",
autorange = 'reversed'),
margin = list(pad = 6),
title = "",
showlegend = F)
}
my_chart(my_data)