4

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)

default

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?

mindlessgreen
  • 11,059
  • 16
  • 68
  • 113

1 Answers1

5

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)

enter image description here

byouness
  • 1,746
  • 2
  • 24
  • 41