[R] microarray-like graph

Jim Lemon jim at bitwrit.com.au
Sat May 20 00:38:27 CEST 2006


Eric Hu wrote:
> Hi, I am beginning to learn R and have a data table that I would like to
> produce a microarray-like plot. The table looks like this:
> 
> 3 0 0 3 -377.61 1.94
> 3 0 0 3 -444.80 2.36
> 2 1 0 3 -519.60 2.39
> 1 1 1 3 -54.88 2.49
> 2 1 1 4 -536.55 2.53
> 1 0 1 2 108.29 2.62
> 2 0 0 2 39.56 2.62
> 3 0 1 4 108.32 2.63
> 2 0 0 2 -455.23 2.84
> 1 0 0 1 -432.30 2.98
> ...
> 
> I would like to assign colors to the first three columns and plot the last
> column against fourth column which is the sum of the first three at each
> row. Can anyone point to me how to approach this? Thanks for your
> suggestions.
> 
Hi Eric,

Here is an initial try at your plot. I doesn't look great, but you may 
be able to use some of the ideas.

hu.df<-read.table("hu.dat")
 > hu.df
    V1 V2 V3 V4      V5   V6
1   3  0  0  3 -377.61 1.94
2   3  0  0  3 -444.80 2.36
3   2  1  0  3 -519.60 2.39
4   1  1  1  3  -54.88 2.49
5   2  1  1  4 -536.55 2.53
6   1  0  1  2  108.29 2.62
7   2  0  0  2   39.56 2.62
8   3  0  1  4  108.32 2.63
9   2  0  0  2 -455.23 2.84
10  1  0  0  1 -432.30 2.98
hu.col<-rgb(hu.df$V1,hu.df$V2,hu.df$V3,maxColorValue=3)
hu.col
  [1] "#BF0000" "#BF0000" "#804000" "#404040" "#804040" "#400040" "#800000"
  [8] "#BF0040" "#800000" "#400000"
plot(hu.df$V6,hu.df$V4,col=hu.col,pch=15,cex=3)

Jim




More information about the R-help mailing list