[R] 3-D interpretation

Ben Bolker bbolker at gmail.com
Wed Dec 11 17:24:15 CET 2013


On 13-12-11 11:13 AM, Shane Carey wrote:
> Hey,
> 
> Nope, it crashes. R stops abruptly. I sent just 500 points to show the
> structure of the data. There is in fact over 22,000 points and it is 3-D
> data composing of x,y,z data
> 
> Cheers

  We really, really need a reproducible example to be able to help
further.  Since the 'akima.li' object is the one causing the trouble
perhaps you could post the results of save() somewhere publicly accessible?

  Do you have the same problem if you skip the rgl.spheres() and
rgl.bbox() steps?

  I'm able to plot a 100x100 random surface, even one with lots of NAs,
without any trouble.  So there must be something special about akima.li
, and guessing is going to be very hard ...

  (At some point it might be useful to know your platform, version of R,
etc., but that will only really become useful if it turns out that other
people can plot your akima.li surface without any trouble ...)

  Ben Bolker

> 
> 
> On Wed, Dec 11, 2013 at 3:24 PM, Ben Bolker <bbolker at gmail.com> wrote:
> 
>> Shane Carey <careyshan <at> gmail.com> writes:
>>
>>>
>>> it just keeps crashing on me,
>>>
>>> It seems to crash on this line
>>>
>>> rgl.surface(akima.li$x,akima.li$y,akima.li$z,color="green",alpha=c(0.5))
>>
>>   When I run the code you gave us along with the data you gave us,
>> I get
>>
>> Error in rgl.surface(akima.li$X, akima.li$Y, akima.li$Z, color = "green",
>>  :
>>   rows < 2
>>
>>   Maybe this is what you mean by "crashing"?  (On this list, "crash"
>> is usually reserved to mean that your instance of R stops abruptly ...
>> the behaviour above would be called an "error").
>>
>>   Looking at the plot generated from the data you sent, all of
>> the (X,Y) points lie on a 1-dimensional curve in the (X,Y) plane --
>> it's not surprising that it's going to be hard to generate an
>> interpolated surface from these points.
>>
>>   Or maybe I'm misunderstanding something.
>>
>> rgl.spheres(dat$X,dat$Z , dat$Y,1,color="red")
>> rgl.bbox()
>> # bivariate linear interpolation
>> # interp:
>> akima.li <- interp(dat$X, dat$Y, dat$Z,
>>                    xo=seq(min(dat$X), max(dat$X), length = 100),
>>                    yo=seq(min(dat$Y), max(dat$Y), length = 100))
>> # interp surface:
>> rgl.surface(akima.li$X,akima.li$Y,akima.li$Z,color="green",alpha=c(0.5))
>>
>> ______________________________________________
>> 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