[R] Scatterplot - Overlap Frequency

2010-08-12 Thread Mestat

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@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.


Re: [R] Scatterplot - Overlap Frequency

2010-08-12 Thread Wu Gong

Hi Marcio,

Your friend has given the answer.

x - rnorm(10)
y - rnorm(10)
ind - c(3,0,1,0,3,0,2,2,0,0) 

plot(x, y, col = grey(0:max(ind)/max(ind))[ind], pch = 16)



Mestat wrote:
 
 I am working o a scatterplot where I would like to plot the variables
 according with another frequency variable.
 

Regards,

Wu

-
A R learner.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Scatterplot-Overlap-Frequency-tp2323322p2323349.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Scatterplot - Overlap Frequency

2010-08-12 Thread Greg Snow
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.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Mestat
 Sent: Thursday, August 12, 2010 2:20 PM
 To: r-help@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@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.

__
R-help@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.