'Density maps/kernel density maps
I am trying to create a map from latitude and longitudes of catch locations. I was able to plot this on the map, however I would like to make densities of these locations. Therefore I have a few questions...
- Would that require me to zoom in on only the Atlantic ocean?
- Should the points be smaller?
- How the heck can I map kernel densities or densities of the most used locations of these coordinates?
library(maps)
library(ggplot2)
library(stringr)
world_map <- map_data("world")
#Creat a base plot with gpplot2
p <- ggplot() + coord_fixed() +
xlab("") + ylab("")
#Add map to base plot
base_world_messy <- p + geom_polygon(data=world_map, aes(x=long, y=lat, group=group),
colour="black", fill="light green") +
ggtitle("striper reports")
base_world_messy
#Strip the map down so it looks clean
cleanup <-
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_rect(fill = 'blue', colour = 'blue'),
axis.line = element_line(colour = "white"), legend.position="none",
axis.ticks=element_blank(), axis.text.x=element_blank(),
axis.text.y=element_blank())
base_world <- base_world_messy + cleanup
base_world
map_data <-
base_world +
geom_point(data=striper,
aes(x=Long, y=Lat), colour="Red",
fill="Red",pch=1, size=.2, alpha=I(0.5)) + ggtitle("striper report")
map_data
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

