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... (Image is in link below)
[1]: https://i.stack.imgur.com/SvqNH.jpg
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
that doesnt seem different to what I had assumed when I made an artificial striper....
what output do you get when you ignore the map part and simply plot points and density of your striper ?
m <- ggplot(striper, aes(x = Long, y = Lat)) +
geom_point()
# contour lines
m + geom_density_2d()