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

时间:2018-04-07 10:14:02

标签: 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)))

enter image description here

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

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

使用line参数给出行而不是点周围的边界: enter image description here

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

请帮忙。

1 个答案:

答案 0 :(得分: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)
                                   )
             )

enter image description here