R plotly:调整3D散点图上的绝对标记大小

4
我正在使用R中的Plotly创建3D散点图,并希望缩小所有点的标记大小。
library(plotly)
plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length) %>% 
add_markers(color=~Species)

默认

我尝试设置了 sizes 参数,但似乎没有改变任何东西。

plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length) %>%
  add_markers(color=~Species,sizes=0.02)

我也尝试了另一个参数sizeref,但仍然没有发生任何变化。

plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length) %>%
  add_markers(color=~Species,marker=list(sizeref=0.02))

是否有其他解决方案来减小所有点的标记大小?或者我做错了什么吗?

1个回答

5
你离正确很近,应该使用size参数,并将marker放入plot_ly()而不是add_markers()中。
library(plotly)
plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length,
        marker = list(size = 20)) %>% 
   add_markers(color=~Species)

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接