Tightly add a border around points created with add_markers

I am trying to create a scatter plot plotlywith borders around points.

The perfect thing:

plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length,
        marker = list(size = 10,
                       color = 'rgba(255, 182, 193, .9)',
                       line = list(color = 'rgba(152, 0, 0, .8)',
                                   width = 2)))

enter image description here

But in my (much more complicated) case, I create a plot with a function add_markersas follows:

plot_ly(data = iris) %>% 
             add_markers(x = ~Sepal.Length, y = ~Petal.Length,
                           color = 'rgba(255, 182, 193, .9)')

The argument linegives a line instead of a border around the points: enter image description here

Adding a parameter symbol = "circle-open"as a parameter also does not help.

Please, help.

+4
source share
1 answer

You must provide these properties as an listargument marker:

plot_ly(data = iris) %>% 
             add_markers(x = ~Sepal.Length, 
                         y = ~Petal.Length,
                         marker = list(
                                  color = 'rgba(255, 182, 193,0.5)',
                                  line = list(color = 'rgba(152, 0, 0, .8)',
                                              width = 2)
                                   )
             )

enter image description here

+4
source

Source: https://habr.com/ru/post/1695908/


All Articles