Why do I get the different order in plotly bar chart than I defined in x and y variables.
E.g.
library(plotly) plot_ly( x = c(\"giraffes\", \"oran
You can also use reorder if you want to order based on a second variable:
reorder
library(plotly) x <- c("giraffes", "orangutans", "monkeys") y <- c(20, 14, 23) plot_ly( x = ~reorder(x,y), y = ~y, name = "SF Zoo", type = "bar" )