[R] add points to 3D plot using p3d {onion}

Viechtbauer Wolfgang (STAT) Wolfgang.Viechtbauer at STAT.unimaas.nl
Wed Jan 27 17:50:23 CET 2010


Just as an aside, the scatterplot3d package does things like this very cleverly. Essentially, when you create a plot with scatterplot3d, the function actually returns functions with values set so that points3d(), for example, "knows" the axis scaling.

Best,

--
Wolfgang Viechtbauer                        http://www.wvbauer.com/
Department of Methodology and Statistics    Tel: +31 (43) 388-2277
School for Public Health and Primary Care   Office Location:
Maastricht University, P.O. Box 616         Room B2.01 (second floor)
6200 MD Maastricht, The Netherlands         Debyeplein 1 (Randwyck)


----Original Message----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Robin Hankin Sent:
Wednesday, January 27, 2010 11:17 To: Bradley Christoffersen
Cc: r-help at r-project.org
Subject: Re: [R] add points to 3D plot using p3d {onion}

> Hello Bradley
>
> I don't think there's an easy way to do what you want because the
> viewing
> angles are internal to p3d().   Frankly p3d() tries to be all things
> to all
> men (the arguments are a mess)  and inevitably isn't as flexible as
> one
> might wish.
>
> I take it you want to do this:
>
> data(bunny)
> p3d(head(bunny,100),d0=2,theta=3)
> points(tail(bunny), col='blue')
>
> You'd want the call to points() to "remember" theta=3,
> and possibly d0=2 as well.
>
> Although I can see a hack....
>
> I'd be very happy to help you offline.
>
>
> best wishes
>
> Robin
>
>
>
>
>
>
> Bradley Christoffersen wrote:
>> Hi,
>>
>> Can anyone guide me as to how I can add points to a p3d() plot from
>> the onion package?  I want to plot points with different colors on
>> the same 3D plot.  Perhaps I can do this without adding points but
>> somehow directing the 'h' parameter to give different color to
>> points based on a factor I assign to them?
>>
>> FYI, I can do this using using scatterplot3d() and points3d(), but
>> these plots lack perspective and hence it is hard to sense depth
>> without the use of color.
>>
>> Thanks,
>> Brad



More information about the R-help mailing list