My question is very similar to this one: R Plot Filled Longitude-Latitude Grid Cells on Map
I used the solution given by Richard to plot the number of earthquakes over a certain time period onto a map of California
library(ggplot2)
library(maps)
caliMap <- map_data('state','california',lwd=50)
g <- (ggplot(aes(x=Longitude,y=Latitude,fill=Events),data=eqGrid) +
geom_tile()) +
geom_polygon(data=caliMap,aes(x=long, y=lat, group=group),
colour='firebrick', fill='white', alpha=0, lwd=1.2)
This is a modified code from Richard's given solution. My question is, does this take into account the alteration of the geometry from the projection of a sphere onto a plane? If so I have difficulty seeing where this is being done. How can I change the form of projection used?
Also, as an aside, how can I change the titles of my legend, etc.? From what I see, if I change the titles, it won't properly pull them from the titles of my data.frame (I really need to change the legend to say 'Events (log n)', but I can't figure it out, and putting a space anywhere messes things up).
I just started using R today after seeing that it had a seemingly easy solution to a problem I couldn't find much help for elsewhere. I'm not a very experienced programmer either, so I appreciate if you can be as simple as possible.