Legend title in plotly
How do I specify title for legend in plotly ? I have a stacked bar graph that plots different durations like 0-10, 11-20. I want the legend title to say 'Duration'. The simplest way to specify a legend title is to set it via ggplot and have plotly read it from the corresponding object: library( plotly ) gg <- ggplot( mtcars, aes( x=mpg, y=wt, color=factor(vs) ) ) + geom_point() + labs( color = "MyTitle" ) ggplotly( gg ) However, the problem is that plotly converts the legend title into an annotation, which becomes disconnected from the legend in the process. In my browser, it also overlaps