Set marker size in plotly

后端 未结 2 1822
名媛妹妹
名媛妹妹 2021-01-12 19:39

How can I change the marker size in plotly in R on a map? If I set the size argument to any number it makes it the same, too big size. And if I map it to a vari

2条回答
  •  伪装坚强ぢ
    2021-01-12 20:04

    The simplest, and probably canonical way is to use the marker.sizeref attribute. You wrap this inside marker=list(...) like this

    plot_geo(sample, locationmode='USA-states') %>%
      add_markers(y=~lat, x=~long, hoverinfo="text",
        color=~Group, text=~Group, size=~Value, 
        marker=list(sizeref=0.1, sizemode="area")) %>%
      layout(title='plotly marker map', geo=x)
    

    Note that, the smaller sizeref, the bigger the markers. E.g with sizeref=0.02 we get

提交回复
热议问题