Javascript 叶形图中的变化标记

Javascript 叶形图中的变化标记,javascript,python,leaflet,folium,Javascript,Python,Leaflet,Folium,我有一个脚本,通过folium在地图上绘制多个点。有没有办法改变标记的形状和颜色 它是否可以通过python代码或应用程序来完成并不重要 您可能会发现单独创建标记比首先构建GeoJSON对象更容易。这将很容易使您能够对其进行样式设置,如示例所示: map_1 = folium.Map(location=[45.372, -121.6972], zoom_start=12,tiles='Stamen Terrain') map_1.simple_marker([45.3288, -121.6625

我有一个脚本,通过folium在地图上绘制多个点。有没有办法改变标记的形状和颜色

它是否可以通过python代码或应用程序来完成并不重要


您可能会发现单独创建标记比首先构建GeoJSON对象更容易。这将很容易使您能够对其进行样式设置,如示例所示:

map_1 = folium.Map(location=[45.372, -121.6972], zoom_start=12,tiles='Stamen Terrain')
map_1.simple_marker([45.3288, -121.6625], popup='Mt. Hood Meadows',marker_icon='cloud')

您可以尝试以下方法:

for i in range(0,len(data)):
folium.Marker([data['lat'][i], data['long'][i]],
          #Make color/style changes here
          icon = folium.Icon(color='green'),
          ).add_to(map_1)

下面是我如何用点绘制的。我实际上是在试着整理一份报告,尽管我仍在解决问题

import folium
import pandas as pd

#create a map
this_map = folium.Map(prefer_canvas=True)

def plotDot(point):
    '''input: series that contains a numeric named latitude and a numeric named longitude
    this function creates a CircleMarker and adds it to your this_map'''
    folium.CircleMarker(location=[point.latitude, point.longitude],
                        radius=2,
                        weight=0).add_to(this_map)

#use df.apply(,axis=1) to "iterate" through every row in your dataframe
data.apply(plotDot, axis = 1)


#Set the zoom to the maximum possible
this_map.fit_bounds(this_map.get_bounds())

#Save the map to an HTML file
this_map.save('html_map_output/simple_dot_plot.html')

this_map

您也可以使用。

我刚刚为这个问题创建了一个示例,我的实际数据包含超过两千个点。
import folium
import pandas as pd

#create a map
this_map = folium.Map(prefer_canvas=True)

def plotDot(point):
    '''input: series that contains a numeric named latitude and a numeric named longitude
    this function creates a CircleMarker and adds it to your this_map'''
    folium.CircleMarker(location=[point.latitude, point.longitude],
                        radius=2,
                        weight=0).add_to(this_map)

#use df.apply(,axis=1) to "iterate" through every row in your dataframe
data.apply(plotDot, axis = 1)


#Set the zoom to the maximum possible
this_map.fit_bounds(this_map.get_bounds())

#Save the map to an HTML file
this_map.save('html_map_output/simple_dot_plot.html')

this_map