[R] passing xlim to coord_map in ggplot2

Ista Zahn istazahn at gmail.com
Wed Mar 21 17:40:24 CET 2012


Hi Zack,

This works as expected on my machine:


tank_trunc <- read.csv("http://r.789695.n4.nabble.com/file/n4492267/upton_tank_trunc_nabble.csv")

michigan_map.df <- map_data('county', 'michigan')
ggplot() + geom_point(aes(lon, lat), data = tank_trunc, na.rm = T) +
geom_path(aes(long, lat, group = group), data = michigan_map.df) +
coord_map('gilbert', xlim = c(-88, -82))

> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] mapproj_1.1-8.3 maps_2.2-5      ggplot2_0.9.0

loaded via a namespace (and not attached):
 [1] MASS_7.3-17        RColorBrewer_1.0-5 colorspace_1.1-1   dichromat_1.2-4
 [5] digest_0.5.2       grid_2.14.2        memoise_0.1        munsell_0.3
 [9] plyr_1.7.1         proto_0.3-9.2      reshape2_1.2.1     scales_0.2.0
[13] stringr_0.6        tools_2.14.2


Maybe you have some out-of-date packages?

Best,
Ista

On Wed, Mar 21, 2012 at 9:28 AM, z2.0 <zack.abrahamson at gmail.com> wrote:
> The first block of code should be reproducible.
>
> For the second block, you need only a data.frame. I've included a few rows
> from the one I'm working with.
>
> Two required libraries: maps, ggplot2.
> http://r.789695.n4.nabble.com/file/n4492267/upton_tank_trunc_nabble.csv
> upton_tank_trunc_nabble.csv
>
> --
> View this message in context: http://r.789695.n4.nabble.com/passing-xlim-to-coord-map-in-ggplot2-tp4490005p4492267.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



More information about the R-help mailing list