When I create a plot with ggplot, everything looks great. When I use ggplotly to add interactivity to the plot, the axis labels overlap with the tick text. Here's a small example:
df <- mtcars df$car <- rownames(df) #intentionally making example with long text p <- ggplot(data = df, aes(x = car, y = hp)) + geom_bar(stat = "identity") + labs(title="Horsepower by car model") + xlab("Make and model of car") + ylab("Horsepower of car") + theme(legend.position="none", axis.text.x=element_text(angle=90,vjust = 0.5)) ggplotly(p)
If you simply view p, everything looks fine, but ggplotly(p) results in axis labels that overlap the tick text.
Any suggestions? I've seen similar questions on StackOverflow but no real solutions.