我正在用大葉草和波特蘭市的一些公開犯罪資料制作熱圖。當我制作最終的熱圖時,它看起來很好,除了這些藍色圓圈覆寫了所有熱圖顏色,使它看起來像一堆藍色斑點。

就像我得到的藍點一樣,但它們周圍的圓圈抹去了熱圖的實際彩色質量。如何隱藏這些藍色圓圈?我正在按照這里的示例進行操作,其中沒有奇怪的藍色圓圈。這是我的代碼:
import folium
from folium import plugins
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
crime = pd.read_csv("../Data/CleanedCrimeData-2021.csv")
crime['OccurTime'] = crime['OccurTime'].apply(str)
crime['OccurTime'] = crime['OccurTime'].apply(lambda x: x.zfill(4))
crime['CrimeDate'] = crime.OccurDate ' ' crime.OccurTime
crime['CrimeDate'] = pd.to_datetime(crime['CrimeDate'])
cols = list(crime)
crime = crime.loc[:, cols]
crime.set_index('CrimeDate', inplace=True)
m = folium.Map(location=[45.5291, -122.6768], zoom_start=12)
for index, row in crime.iterrows():
folium.CircleMarker([row['OpenDataLat'], row['OpenDataLon']],
radius=1,
popup=row['OffenseType'],
fill_color="#3db7e4", # divvy color
).add_to(m)
# convert to (n, 2) nd-array format for heatmap
crimeArr = crime[['OpenDataLat', 'OpenDataLon']]
# plot heatmap
m.add_child(plugins.HeatMap(crimeArr))
m
uj5u.com熱心網友回復:
使用radius關鍵字Heatmap來調整圓的半徑。
這可能如下所示:
plugins.HeatMap(crimeArr, radius=0)
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/350784.html
上一篇:AttributeError:'NoneType'物件沒有屬性'longitude'
下一篇:更新行的替代方法
