potockan
potockan

Reputation: 4088

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.

Upvotes: 5

Views: 3772

Answers (1)

Martin C. Arnold
Martin C. Arnold

Reputation: 9678

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

Upvotes: 5

Related Questions