James Platt
2011-Feb-26 19:59 UTC
[R] wireframe() display a graph with two colors, not a gradient.
Hi all, I'm quite new to wireframe, essentially what I want to do is display a graph, and z-values > 1 would be yellow and those < 1 would be blue. This is a bit of my data. 0.334643563 0.350913807 0.383652307 0.370325283 0.38779016 0.42387392 0.39861579 0.418389687 0.460692165 0.43888516 0.468015843 0.520560489 0.499544084 0.535099422 0.60982153 0.569888047 0.634351734 0.717646392 0.717202578 0.810887467 0.935152498 0.901982916 1.044895388 1.228306176 1.12856184 1.314210456 1.462055626 1.377314404 1.540372345 1.6206216 1.494044604 1.618244219 1.631295797 data.m = as.matrix(read.table("/Users/James/Desktop/c.txt", sep='\t')) 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) i know I probably need to use the col.regions or level.colors argument, but I'm not sure what I actually need to supply to the arguments to get it to work. All the examples I've seen also have a gradient of color between two or more colors, I want to color half the graph with z values > 1 yellow, and <1 blue. Thanks for any help. James [[alternative HTML version deleted]]
Deepayan Sarkar
2011-Mar-07 08:52 UTC
[R] wireframe() display a graph with two colors, not a gradient.
On Sun, Feb 27, 2011 at 1:29 AM, James Platt <james-platt at hotmail.co.uk> wrote:> Hi all, > > I'm quite new to wireframe, essentially what I want to do is display a graph, and z-values > 1 would be yellow and those < 1 would be blue. > This is a bit of my data. > > 0.334643563 ? ? 0.350913807 ? ? 0.383652307 > 0.370325283 ? ? 0.38779016 ? ? ?0.42387392 > 0.39861579 ? ? ?0.418389687 ? ? 0.460692165 > 0.43888516 ? ? ?0.468015843 ? ? 0.520560489 > 0.499544084 ? ? 0.535099422 ? ? 0.60982153 > 0.569888047 ? ? 0.634351734 ? ? 0.717646392 > 0.717202578 ? ? 0.810887467 ? ? 0.935152498 > 0.901982916 ? ? 1.044895388 ? ? 1.228306176 > 1.12856184 ? ? ?1.314210456 ? ? 1.462055626 > 1.377314404 ? ? 1.540372345 ? ? 1.6206216 > 1.494044604 ? ? 1.618244219 ? ? 1.631295797 > > > > > > data.m = as.matrix(read.table("/Users/James/Desktop/c.txt", sep='\t')) > 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) > > i know I probably need to use the col.regions or level.colors argument, but I'm not sure what I actually need to supply to the arguments to get it to work. > All the examples I've seen also have a gradient of color between two or more colors, I want to color half the graph with z values > 1 yellow, and <1 blue.Something like wireframe(volcano, drape = TRUE, at = c(90, 150, 200)) perhaps? Note that color may not vary within a quadrilateral, so your boundary will be jagged to some extent. -Deepayan