Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Plotting heatmap over the San Francisco map for Crime Classification Problem

$
0
0

@syed.danish wrote:

Hi,
I am working on the crime classification problem from kaggle, I am trying to plot a heatmap of crime incidents over the map of San Francisco. Below is the scatter plot and code for the scatter plot of incidents in SF.
SF_map=np.loadtxt("/home/syed/crime/sf_map_copyright_openstreetmap_contributors.txt")
lon_lat_box = (-122.5247, -122.3366, 37.699, 37.8299)
asp = SF_map.shape[0] * 1.0 / SF_map.shape[1]
fig = plt.figure(figsize=(16,16))
plt.imshow(SF_map,cmap='gray',extent=lon_lat_box,aspect=1/asp)
ax=plt.gca()
train[(train['Y']<40)].plot(x='X',y='Y',ax=ax,kind='scatter',marker='o',s=20,color='red',alpha=0.01)
ax.set_axis_off()


I want to plot a heatmap over SF for the frequency of incident. I tried using seaborn.heatmap but couldn't get it to work. Please suggest me some good approach.
Here is the file for SF map : https://www.kaggle.com/benhamner/sf-crime/saving-the-python-maps-file/output
Thanks.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles