R plotly - showlegend = FALSE 不起作用

迈克尔·塞缪尔

为什么不showlegend = FALSE抑制生成散点图的简化 R 代码中的图例?感谢您的帮助。

plot_ly(x =  ~  1:5,  y =  ~ 1:5, type="scatter",mode="markers",
 color =  1:5,
 showlegend = FALSE)
杜布斯

showlegend参数plot_ly仅指因素的标签。例如

plot_ly(x =  ~  1:5,  y =  ~ 1:5, type="scatter",mode="markers",
    color =  as.factor(1:5))

在此处输入图片说明

plot_ly(x =  ~  1:5,  y =  ~ 1:5, type="scatter",mode="markers",
    color =  as.factor(1:5), showlegend = FALSE)

在此处输入图片说明

不幸的showscale是没有为散点图实现,所以你需要使用不太优雅hide_colorbar()的色阶函数:

plot_ly(x =  ~  1:5,  y =  ~ 1:5, type="scatter",mode="markers",
        color =  1:5) %>% hide_colorbar() 

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章