Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotly, add border around points created with add_markers

I'm trying to create a plotly scatter plot with border around points.

The ideal thing is:

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'm creating the plot with add_markers function like that:

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

With that the line argument gives the line instead of border around points: enter image description here

Adding symbol = "circle-open" as parameter doesn't help either.

Please help.

like image 478
potockan Avatar asked Apr 07 '18 10:04

potockan


1 Answers

You have to provide these properties as a list to the argument 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

like image 184
Martin C. Arnold Avatar answered Oct 11 '22 00:10

Martin C. Arnold