我正在 R 中使用plotly 创建 3D 散点图,我想减小所有点的标记大小。
library(plotly)
plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length) %>%
add_markers(color=~Species)
Run Code Online (Sandbox Code Playgroud)
我试图设定sizes论点,但这似乎并没有改变任何事情。
plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length) %>%
add_markers(color=~Species,sizes=0.02)
Run Code Online (Sandbox Code Playgroud)
还尝试了另一种说法sizeref。然而,什么也没发生。
plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length) %>%
add_markers(color=~Species,marker=list(sizeref=0.02))
Run Code Online (Sandbox Code Playgroud)
还有其他解决方案可以减小所有点的标记大小吗?或者我做错了什么?
你很接近,论点是size,并且标记应该进入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)
Run Code Online (Sandbox Code Playgroud)