I'm sure this is smack-head moment, but I haven't been able to find an
example of this on Nabble or SO, so thought I'd ask.
This works:
michigan <- map_data('county', 'michigan')
mich_points <- data.frame(x = rnorm(n = 200, median(michigan[,1]), 0.75), y
= rnorm(n = 200, median(michigan[,2]), 0.75))
ggplot() + geom_path(aes(long, lat, group = group), data = michigan) +
geom_point(aes(x, y), data = mich_points) + coord_map('gilbert', xlim
c(-86, -84))
This generates the following error:
*Error in unit(x, default.units) : 'x' and 'units' must have
length > 0*
#Where tank_trunc is a data.frame with two columns, 'lon' and
'lat'
containing point coordinates in storage mode 'double'.
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))
I thought at first maybe the overlay of one layer on another caused the
limiting to freak out. But the sketch code above disproves that theory --
thoughts? Some kink in ggplot2's latest implementation? Do I need another
package? (e.g., the Scales disunion in the latest release...)
Thanks, as always,
Zack
--
View this message in context:
http://r.789695.n4.nabble.com/passing-xlim-to-coord-map-in-ggplot2-tp4490005p4490005.html
Sent from the R help mailing list archive at Nabble.com.