Plotly,在add_markers创建的点周围添加边框

pot*_*kan 5 r border scatter-plot r-plotly

我正在尝试创建一个plotly带点边界的散点图.

理想的是:

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)))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

但在我(更复杂)的情况下,我正在用这样的add_markers函数创建情节:

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

有了这个,line参数给出了线而不是点周围的边界: 在此输入图像描述

添加symbol = "circle-open"为参数也无济于事.

请帮忙.

Mar*_*old 5

您必须将这些属性作为list参数提供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)
                                   )
             )
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述