建营销型网站,海南建设厅评审网站,微信小程序页面模板,wordpress 如何布局我想我最好加上我自己的答案#xff0c;因为来自GlobalTraveler的答案涉及到画很多线#xff0c;我觉得有点脏。在似乎在叶中确实没有这样做的选择#xff0c;但你可以画多个标记#xff0c;并分别给它们着色import numpy as npfrom matplotlib import cmimport folium# rg…我想我最好加上我自己的答案因为来自GlobalTraveler的答案涉及到画很多线我觉得有点脏。在似乎在叶中确实没有这样做的选择但你可以画多个标记并分别给它们着色import numpy as npfrom matplotlib import cmimport folium# rgb tuple to hexadecimal conversiondef rgb2hex(rgb):rgb [hex(int(256*x)) for x in rgb)]r, g, b [str(x)[2:] for x in rgb]return #{}{}{}.format(r, g, b)# Defines the color mapping from speeds to rgbacolor_mapper cm.ScalarMappable(cmapcm.cividis)rgb_values color_mapper.to_rgba(speeds)[:3] # keep rgb and drop the a columncolors [rgb2hex(rgb) for rgb in rgb_values]my_map folium.Map(location[ave_lat, ave_long], zoom_start14)for point, color, speed in zip(points, colors, speeds):folium.CircleMarker(locationpoint,radius1.25,popupstr(speed),fill_colorcolor).add_to(my_map)my_map要实现这一点您需要有一个包含2列的数组points以及一个与points一样多行的数组speeds。请注意您可以将cm.cividis更改为适合您需要的任何内容(请参阅参考文献here)