我一直在使用的时候有一个问题,ggplotly()一个ggplot图:y轴消失.这是一个使用iris数据集的可重现的例子(这个例子非常简单,但无论如何)
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)
Run Code Online (Sandbox Code Playgroud)
如您所见,Y轴标题消失了.
好吧,如果ylim删除它可行,但我想指定y限制.
我试着做以下事情:
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 …Run Code Online (Sandbox Code Playgroud)