[R] Rgobbi and colours question

mister_bluesman mister_bluesman at hotmail.com
Tue Jun 12 01:12:53 CEST 2007


Hi

I am using R to implement a multidimensional algorithm which maps places
based on the distances between each other. This is presented really well in
Rggobi. 

However, for each place plotted, I have another numerical statistic between
0 and 1 which I would like to represent by colouring the points in Rgobbi.
However I do not know how to do this.
 
The file I am using is called places.txt and has the following contents:

            Chelt     Exeter   London  Birm
Chelt   0       118     96      50
Exeter  118     0       118     163
London  96      118     0       118
Birm    50      163     118     0

To plot these, the R code is as follows:

library(rggobi)
Places<-read.table("C:\\places.txt")
Places.location <- cmdscale(Places, k=2)
round(Places.location,0) 
g<-ggobi(Places.location)

 
Now, for each point plotted I want to assign a colour to it based on the
statistic in a file called PlacesStats.txt which currently has the following
format:

0.1  0.3  0.4  0.5

With the values in order of the names of the places given above so that:

0.1 is assigned to Chelt
0.3 is assigned to Exeter
0.4 is assigned to London
0.7 is assigned to Birm

Ideally, I want a gradient of two colours so that say, 0 = blue and 1 = red
and values between are a mixture.

Any ideas on how I could do this? Would I need to change the PlacesStats.txt
file so that is reads:

Chelt 0.1
Exeter 0.3
London 0.4
Birm 0.7

for example?

I would be very grateful if anybody could help.

Many thanks
-- 
View this message in context: http://www.nabble.com/Rgobbi-and-colours-question-tf3904622.html#a11070461
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list