【问题标题】:Plotly, add border around points created with add_markersPlotly,在使用 add_markers 创建的点周围添加边框
【发布时间】:2018-09-17 06:38:44
【问题描述】:

我正在尝试创建一个带有点周围边框的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)))

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

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

line 参数给出了线而不是点周围的边界:

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

请帮忙。

【问题讨论】:

    标签: r border scatter-plot r-plotly


    【解决方案1】:

    您必须将这些属性作为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)
                                       )
                 )
    

    【讨论】:

      猜你喜欢
      • 2016-12-02
      • 2014-09-12
      • 1970-01-01
      • 1970-01-01
      • 2018-07-21
      • 2018-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多