[R] Scatterplot - Overlap Frequency

Greg Snow Greg.Snow at imail.org
Thu Aug 12 23:15:16 CEST 2010


If you want a grid of hexagons, look at the examples in the my.symbols function (TeachingDemos package), one of those gives a way to create the grid of hexagons (not as efficient as the hexbin package, but allows you to set your own colors).

For choosing colors you may want to look at the RColorBrewer package or do a search for colorramp (several packages have functions for color ramps).  The findInterval function may also be of help if you do not want a 1 to 1 color match.

Hope this helps,

-- 
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 Mestat
> Sent: Thursday, August 12, 2010 2:20 PM
> To: r-help at r-project.org
> Subject: [R] Scatterplot - Overlap Frequency
> 
> 
> Hi listers...
> I am working o a scatterplot where I would like to plot the variables
> according with another frequency variable.
> Another friend here proposed this code...
> x <- rnorm(10)
> y <- rnorm(10)
> ind <- c(1,0,1,0,1,0,1,1,0,0)
> plot(x, y, col = ind + 1, pch = 16)  # 1 is black, 2 is red
> 
> But in my case I would like to identify with different colors according
> with
> a frequency variable.
> x <- rnorm(10)
> y <- rnorm(10)
> ind <- c(3,0,1,0,3,0,2,2,0,0)
> 
> I made some research and I would like to do something like the function
> HEXBIN does:
> source("http://bioconductor.org/biocLite.R")
> biocLite("hexbin")
> library(hexbin)
> x <- rnorm(1000)
> y <- rnorm(1000)
> bin<-hexbin(x, y, xbins=50)
> plot(bin, main="Hexagonal Binning")
> 
> But in my case I have another variable with the frequency and not high
> density frequency according the two plotted variables...
> Any suggestions, thanks...
> Marcio
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Scatterplot-Overlap-Frequency-
> tp2323322p2323322.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