不确定如何将颜色图与 Folium 标记图一起使用

Unsure how to use colormap with Folium marker plot

我有一个包含纬度、经度和功率百分比的数据框。我想做一些非常简单但不确定如何做的事情:应用颜色图根据数据点的百分比为数据点着色。所以 90% 是红色,100% 是蓝色。我已经成功创建了地图和颜色图,但不确定下一步如何进行。

import folium
import pandas as pd
import folium.plugins

import branca
import branca.colormap as cm

data = [
    [33.823400, -118.12194, 99.23],
    [33.823500, -118.12294, 95.23],
    [33.823600, -118.12394, 91.23],
    [33.823700, -118.12494, 90.00]
]

df = pd.DataFrame(data, columns=['latitude','longitude','power'])

x_start = (df['latitude'].max() + df['latitude'].min()) / 2
y_start = (df['longitude'].max() + df['longitude'].min()) / 2
start_coord = (x_start, y_start)

map = folium.Map(location=start_coord, zoom_start=12)

lat = list(df.latitude)
lon = list(df.longitude)

for loc in zip(lat, lon):
    folium.Circle(
        location=loc,
        radius=10,
        #fill=True,
        #color='blue',
        #fill_opacity=0.7
    ).add_to(map)

display(map)

colormap = cm.LinearColormap(colors=['red','lightblue'], index=[90,100],vmin=90,vmax=100)
colormap

我很着急,但我过去就是这样做的。创建 CM,然后像这样调用它 colormap(.9)

import folium
import pandas as pd
import folium.plugins

import branca
import branca.colormap as cm

data = [
    [33.823400, -118.12194, 99.23],
    [33.823500, -118.12294, 95.23],
    [33.823600, -118.12394, 91.23],
    [33.823700, -118.12494, 90.00]
]

df = pd.DataFrame(data, columns=['latitude','longitude','power'])

x_start = (df['latitude'].max() + df['latitude'].min()) / 2
y_start = (df['longitude'].max() + df['longitude'].min()) / 2
start_coord = (x_start, y_start)


colormap = cm.LinearColormap(colors=['red','lightblue'], index=[90,100],vmin=90,vmax=100)

map = folium.Map(location=start_coord, zoom_start=12)


lat = list(df.latitude)
lon = list(df.longitude)
pow = list(df.power)


for loc, p in zip(zip(lat, lon), pow):
    folium.Circle(
        location=loc,
        radius=10,
        fill=True,
        color=colormap(p),
        #fill_opacity=0.7
    ).add_to(map)

map.add_child(colormap)

display(map)