R plotly-showlegend=FALSE不起作用

R plotly-showlegend=FALSE不起作用,r,plotly,R,Plotly,为什么showlegend=FALSE不在这个简化的R代码中抑制图例,生成一个绘图仪散点图?谢谢你的帮助 plot_ly(x = ~ 1:5, y = ~ 1:5, type="scatter",mode="markers", color = 1:5, showlegend = FALSE) plot中的showlegend参数仅指因子标签。e、 g plot_ly(x = ~ 1:5, y = ~ 1:5, type="scatter",mode="markers",

为什么
showlegend=FALSE
不在这个简化的R代码中抑制图例,生成一个绘图仪散点图?谢谢你的帮助

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

plot
中的
showlegend
参数仅指因子标签。e、 g

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

不幸的是,
showscale
没有为散点图实现,因此您需要使用不太优雅的
hide_colorbar()
函数来实现色标:

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

非常感谢。这的确是一个快速的回答!我的荣幸:如果你认为这是一个完整的答案,你应该使用复选标记来标记它为“回答”。
plot_ly(x =  ~  1:5,  y =  ~ 1:5, type="scatter",mode="markers",
        color =  1:5) %>% hide_colorbar()