Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't get rid of these circles while making a folium driven heat map

I’m making a heat map with folium and some open crime data from the city of Portland. When I make the final heatmap, it looks fine, except these blue circles cover up all the heat map colors, making it look like a bunch of blue blobs.
enter image description here

Like the blue dots I get, but the circles around them obliterate the actual colorful qualities of the heat map. How do I hide these blue circles? I’m following the example here where there’s no weird blue circles.
Here’s my code:

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use the radius keyword of the Heatmap to adjust the radius of the circles.

This could look like this:

plugins.HeatMap(crimeArr, radius=0)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading