[R] overlay histograms on map at map coordinates
Greg Snow
Greg.Snow at imail.org
Tue Nov 23 21:15:29 CET 2010
Look at the subplot function in the TeachingDemos package.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Steve Bellan
> Sent: Monday, November 22, 2010 9:41 PM
> To: r-help at r-project.org
> Subject: [R] overlay histograms on map at map coordinates
>
> Hi all,
>
> I'm trying to visualize animal movement data characteristics
> spatiotemporally by overlaying many different histograms on a map. I
> want the histograms to be plotted at coordinates in the map that
> matches a region they describe. If I was just doing this once, I'd
> fiddle in Illustrator after R and avoid the headache. But I'll be
> doing it many many times so it seems worth the elegance &
> repeatability.
>
> For example, say we have the following data:
>
> covariate <- rep(letters[1:10], each = 100)
> shape.pars <- rep(seq(.5,.7, length.out = 10), each = 100)
> zz <- rgamma(1000, shape = shape.pars, scale = 2)
> map <- data.frame(factor = unique(covariate), xx = rnorm(10), yy =
> rnorm(10))
>
> I'd like to be able to have 10 histograms plotted for each level of
> the covariate at the coordinates specified in the map data.frame.
> Ideally, I'd like to be able to specify whether they were plotted to
> the left, right, top, bottom or center of the coordinates similar to
> in text() and other graphical functions. Looking around the archives,
> all I've come across are the viewport system in library(grid) which
> doesn't seem to be able to handle plot() hist() or other such
> functions. Otherwise, I could create viewports for each histogram
> inside the map's coordinate system.
>
> Any ideas? Thanks!
>
> Steve
>
>
> Steve Bellan
> MPH, Epidemiology
> PhD Candidate, Environmental Science, Policy & Management
> Getz Lab
> University of California, Berkeley
>
> ______________________________________________
> 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