ggplot使用ggplot移除geom_line绘图的图例。
例如,见下文:
library(plotly)
g <- ggplot(iris)
g = g + geom_line(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 0.05)
g # Here is a legend
(gg <- ggplotly(g)) # Legend has now been removed.有什么办法找回传奇吗?
我正在使用plotly_2.0.19和ggplot2_2.0.0.9000。
发布于 2016-01-05 13:23:12
出于某种原因,ggplotly从未为geom_line添加过一个图例。文档只有在添加点的时候才有传说。我建议使用透明点作为一项工作。
{ ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_line() +
geom_point(alpha = 0) } %>%
ggplotly()

https://stackoverflow.com/questions/34612286
复制相似问题