<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Robert,<br>
<br>
This is great, thanks for the reference! In that example, Hadley is
using map_data to bring in the shapefile as a data frame. I'm not sure
how this would be best accomplished using readShapePoly (I want to use
my own, projected and slightly altered shapefiles). The way I've done
it (and it works) is below but I welcome a better approach. This takes
a long time to draw but I'm assuming this is related to the level of
detail I'm using in my county boundaries.<br>
<br>
counties<-readShapePoly("X:/counties_esri06_teale.shp")<br>
counties2<-sp2tmap(counties)<br>
names(counties2)<-c("group", "X", "Y")<br>
<br>
p<-ggplot(Elev,aes(X, Y))+geom_polygon(data=counties2,
colour="white", fill="grey60")+geom_point(aes(color=ElevCat))+<br>
scale_colour_brewer(pal = "YlOrBr")<br>
<br>
<br>
Thanks again! Zev<br>
<br>
Robert J. Hijmans wrote:
<blockquote
cite="mid:dc22b2571003020924y351018eye5f010f4beb8b85@mail.gmail.com"
type="cite">
<pre wrap="">Zev,
Here is an example:
<a class="moz-txt-link-freetext"
href="http://blog.revolution-computing.com/2009/11/choropleth-challenge-result.html">http://blog.revolution-computing.com/2009/11/choropleth-challenge-result.html</a>
Robert
On Tue, Mar 2, 2010 at 9:07 AM, Zev Ross <a
class="moz-txt-link-rfc2396E" href="mailto:zev@zevross.com"><zev@zevross.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi All,
I'm using the ggplot2 library to make some plots and I'm wondering how I
could plot a shapefile along with my points
# I use this to plot my points
p<-ggplot(elev,aes(X, Y))+geom_point(aes(color=Elev, size=Elev))
# here I read in the county shapefile
counties<-readShapePoly("X:/counties_teale.shp")
# how do I add this to my plot would I use geom_polygon somehow?
Thank you, Zev
--
Zev Ross
ZevRoss Spatial Analysis
120 N Aurora, Suite 3A
Ithaca, NY 14850
607-277-0004 (phone)
866-877-3690 (fax, toll-free)
<a class="moz-txt-link-abbreviated" href="mailto:zev@zevross.com">zev@zevross.com</a>
_______________________________________________
R-sig-Geo mailing list
<a class="moz-txt-link-abbreviated"
href="mailto:R-sig-Geo@stat.math.ethz.ch">R-sig-Geo@stat.math.ethz.ch</a>
<a class="moz-txt-link-freetext"
href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Zev Ross
ZevRoss Spatial Analysis
120 N Aurora, Suite 3A
Ithaca, NY 14850
607-277-0004 (phone)
866-877-3690 (fax, toll-free)
<a class="moz-txt-link-abbreviated" href="mailto:zev@zevross.com">zev@zevross.com</a></pre>
</body>
</html>