[R] ggmap (or ggplot2 with mapping question)
David Winsemius
dwinsemius at comcast.net
Sat Dec 27 01:16:57 CET 2014
> On Dec 26, 2014, at 3:26 PM, Roy Mendelssohn - NOAA Federal <roy.mendelssohn at noaa.gov> wrote:
>
> HI All:
>
> Okay I am feeling particular brain dead today. i have the following map created so far using ggmap:
>
>> library(ggmap)
>> myLocation <- c(-178, -28, -72, 48)
>> myMap <- get_map(location=myLocation, source="google", maptype="satellite", crop=FALSE)
>>
All if get is a matrix. No map.
>
> I want to color in some lat-lon 5 degree boxes based on some criterion, and it look like this could be done use geom_polygon if I can figure out how to get the data in the format required for geom_polygon. To simplify the problem, suppose i have a bounding box:
>
> subbox<-c(-130, 20, -125, 25)
>
That looks more like a specification for geom.rect than for geom_polygon.
> and I want to color that box red on myMap defined above. To put this in context, I actually have 360 squares which have been clustered by some criteria, and I want to color them all based on the cluster number of the box. but if I can figure out how to do the simple problem above I can extend it to the more general problem.
>
> Basically the question is how can I get that simple box information into the format required for eom_polygon.
If it were used for eom_polygon I would imagine you need to put it in the form pairs (x,y)
subbox<-list(x=c(-130,-125,-125,-130,-130),y=c( 20,20,25, 25,20))
Just a guess mind, you.
—
David.
>
> Thanks for any help.
>
> -Roy
>
>
> **********************
> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
More information about the R-help
mailing list