When plotting a ggplot object using ggplotly, legend.position is always 'right' even if I chose legend.position = 'top' or any of the other options. It only works as it is supposed to when I specify legend.position = 'none' that it actually disappears.
ggplot displays the legend fine.
library(tibble)
library(ggplot2)
df <- tibble(year = c(2000, 2001, 2000, 2001),
freq = c(3, 4, 2, 9),
clas = c("A", "A", "B", "B"))
ggplot(df, aes(year, freq, color = clas)) +
geom_line() +
theme(legend.position = 'top')

When I try this instead:
library(plotly)
ggplotly(
ggplot(df, aes(year, freq, color = clas)) +
geom_line() +
theme(legend.position = 'top')
)
I get the legend on the right, as I show in this shiny app.