Sorry about not including data. Its quite a large dataset.
				
1	2	3
0	0.334643563	0.350913807	0.383652307
15	0.370325283	0.38779016	0.42387392
30	0.39861579	0.418389687	0.460692165
45	0.43888516	0.468015843	0.520560489
60	0.499544084	0.535099422	0.60982153
75	0.569888047	0.634351734	0.717646392
90	0.717202578	0.810887467	0.935152498
105	0.901982916	1.044895388	1.228306176
120	1.12856184	1.314210456	1.462055626
135	1.377314404	1.540372345	1.6206216
150	1.494044604	1.618244219	1.631295797


Theres another 10 columns of that and another 160+ rows
The first column are x-axis labels hence I didn't load them ([,-1])
First row is the y axis values.
Other values are z-axis values, these range between 0 and 2.

I couldn't get it to work, I'm reasonably new to R. I guess the question is what values should be in place of x and in your code the two 30 numbers. I had a look through the help to no avail.

(also sorry about posting to the wrong list - if it makes it any better I am on a Macbook pro)

Thanks, James

On 24 Feb 2011, at 19:56, David Winsemius wrote:

> 
> On Feb 24, 2011, at 1:01 PM, James Platt wrote:
> 
>> Hi all,
>> 
>> I'm trying to plot a 3D graph using wireframe, and I want to colour the graph dependent on z axis values.  my z axis range is 0 - 2. Basically what I want is to colour from various points different colours. so say 1.4-2 would be blue, 0.4-1.4 red 0 - 0.4 green or whatever colours.
>> 
>> 
>> data.m = as.matrix(read.table("data.txt", sep='\t', header=T))[,-1]
>> library(lattice)
>> wireframe(data.m,aspect = c(0.3), shade=TRUE, screen = list(z = 0, x = -45), light.source = c(0,0,10), distance = 0.2,zlab="Freq",xlab="base",ylab="Fragment")
>> 
>> 
>> That is what I have so far, this just uses the rainbow colour, but i want to assign specific colours to specific regions. I have tried to look through the documentation but its not terribly clear to me.
> 
> Following the advice in help(wirefrane) you need to look at the levelplot section for advice re: a proper specification to colorkey and follow the appropriate links in the help pages. Whether your data is a proper input to wireframe cannot be determined from the included information, although I suppose your reported success suggests it is.
> 
> This is an untested (since there was nothing to test) wild-assed guess after reading the material I pointed to:
> 
> wireframe(data.m,aspect = c(0.3), shade=TRUE, screen = list(z = 0, x = -45),
>   light.source = c(0,0,10), distance = 0.2,zlab="Freq",xlab="base",ylab="Fragment",
>   col=level.colors(x, at = do.breaks(range(data.m), 30),
>                    col.regions = colorRampPalette(c("red", "white", "blue")(30))
>      )
> 
> (Also not a Mac question so is on the wrong list.)
> 
> --
> 
> David Winsemius, MD
> West Hartford, CT
> 
> 


	[[alternative HTML version deleted]]

