且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置标记大小

更新时间:2023-12-05 21:10:28

最简单且可能是规范的方法是使用marker.sizeref属性.您可以像这样将其包裹在marker=list(...)

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)

请注意,sizeref越小,标记越大.例如,通过sizeref=0.02我们得到

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