简体   繁体   中英

R plotly: Adjust absolute marker size on 3D scatterplot

I am creating a 3D scatterplot using plotly in R and I would like to reduce the marker size of all points.

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

默认

I tried to set the sizes argument, but that doesn't seem to change anything.

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

Also tried another argument sizeref . Still, nothing happens.

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

Any other solution to decrease the marker size of all points? Or am I doing something wrong?

You were close, the argument is size , and marker should go into plot_ly() instead of add_markers() .

library(plotly)
plot_ly(iris,x=~Petal.Width,y=~Sepal.Width,z=~Petal.Length,
        marker = list(size = 20)) %>% 
   add_markers(color=~Species)

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM