I have a problem when using the ggplotly() graph for ggplot : the y axis disappears. Here's a reproducible example using the iris dataset (this example is quite a dump, but whatever)
data(iris) g = ggplot(data = iris, aes(x = Petal.Length, y = Petal.Width, fill = Species)) + geom_bar(stat = "identity", position = "dodge") + scale_fill_manual(name = "legend", values = c("blue", "red", "green")) + ylab("Y title") + ylim(c(0,3)) + xlab("X title") + ggtitle("Main title") g ggplotly(g)
As you can see, the name of the Y axis has disappeared.
Well, if ylim removed, it works, but I would like to specify y limits.
I tried to do the following:
data(iris) g = ggplot(data = iris, aes(x = Petal.Length, y = Petal.Width, fill = Species)) + geom_bar(stat = "identity", position = "dodge") + scale_fill_manual(name = "legend", values = c("blue", "red", "green")) + scale_y_continuous(name = "Y title", limits = c(0, 3)) + xlab("X title") + ggtitle("Main title") g ggplotly(g)
But now this is the name of a legend that does not fit.
My configuration: R 3.2.0, plotly 2.0.16, ggplot2 2.0.0
In both examples, the graph given by ggplot is what I want, but ggplotly gives something else. This is a problem, is there a workaround?