Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # IMPORT CSV DATA
  2. sf_crime <- read_csv('sf_crime-data-2017.csv'
  3. ,col_names = c('lon'
  4. ,'lat'
  5. )
  6. ,skip = 1
  7. )
  8. # No of rows
  9. nrow(sf_crime)
  10.  
  11. map_sf <- get_map('Gurugram', zoom = 12, maptype = 'satellite')
  12. # PLOT BASIC SF MAP
  13. ggmap(map_sf)
  14.  
  15. # VIRIDIS (inferno), alpha = .5
  16. ggmap(map_sf) +
  17. stat_density2d(data = sf_crime, aes(x = lon, y = lat, fill = ..density..), geom = 'tile', contour = F, alpha = .5) +
  18. scale_fill_viridis(option = 'inferno')
  19.  
  20. X Y
  21.  
  22. -122.4017618 37.71452361
  23.  
  24. -122.4245824 37.76854434
  25.  
  26. -122.4450517 37.71294772
  27.  
  28. -122.4154488 37.77829352
  29.  
  30. -122.4745374 37.78043476
  31.  
  32. -122.5047207 37.75952427
  33.  
  34. -122.3895176 37.77246824
  35.  
  36. -122.3895176 37.77246824
  37.  
  38. -122.4217477 37.76274366
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement