[R] ggplot map bounds
Ista Zahn
izahn at psych.rochester.edu
Mon Nov 1 16:25:44 CET 2010
Hi Adrienne,
I think
usamap + xlim(c(-85, -75)) + ylim(c(33,37))
will do what you want.
Best,
Ista
On Mon, Nov 1, 2010 at 10:52 AM, Adrienne Wootten <amwootte at ncsu.edu> wrote:
> To all,
>
> I'm working with code below to produce a map with station data plotted in
> points, but right now I'm having trouble with the mapping portion of this
> code
>
>
> states <- data.frame(map("state", plot=FALSE,xlim=
> c(-85,-75),ylim=c(33,37))[c("x","y")])
> usamap<- ggplot(states)+geom_path(aes(x,y))
> usamap
>
> When I plot this the problem is that the bounds of the plot is from 31N to
> 38N and 90W to 75W. The problem is that I only need the bounds of the plot
> to be from 33N to 37N and 85W to 75W. The way this is now, if I try to
> subset the states object, I get a garbled mess of lines. The rest of the
> code provides what I'm trying to do with the attached data.
>
>
> usamap + geom_point(data=obsmeans,aes(x=lon,y=lat,colour = month_1),size=5)
> +
> scale_colour_gradientn(data=obsmeans,colour=rev(rainbow(17)),breaks=seq(5,21,by=1),limits=c(5,21))
>
>
> Any ideas for how I can fix this map would be appreciated!
>
> Adrienne
>
> --
> Adrienne Wootten
> Graduate Research Assistant
> State Climate Office of North Carolina
> Department of Marine, Earth and Atmospheric Sciences
> North Carolina State University
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
More information about the R-help
mailing list