[R] Plotting 3d data?

Duncan Murdoch murdoch at stats.uwo.ca
Tue Jun 17 00:38:18 CEST 2008


On 16/06/2008 4:57 PM, Wesley Tansey wrote:
>> If your data is really a bunch of points, not on a grid, then you need 
>> to use plot3d() to plot it as points, or convert it to a surface.  The 
>> interp() function in the akima package can do that.  (There are lots of 
>> other possibilities too.)
> 
> 
> Actually, my data is on a grid. The values are something like 0 < x < y <
> 0.05, with a 0.00005 step for both x and y. I tried using interp() as
> follows:
> 
> data <- ..
> 
> x <- data$X
> 
> y <- data$Y
> 
> z <- data$Z
> 
> temp <- interp(x, y, z)
> 
> plot.new()
> image(temp, add=TRUE)

Normally you would not use plot.new(), and you would skip add=TRUE.  Let 
image work out the scale of the plot.  (add=TRUE tells it to use the 
existing scale, among other things.)

Duncan Murdoch
> 
> 
> I figured showing an image would just verify that the grid was formed
> correctly, but that didn't seem to work.
> 
> 
> Wesley
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list