Skip to content
Back to formatted view

Raw Message

Message-ID: <50A04202.3020802@gmail.com>
Date: 2012-11-12T00:25:38Z
From: Duncan Murdoch
Subject: 3d plotting from a 2d array
In-Reply-To: <CABWxYnbWLTax=kJpz3MUg-QF8Mj_ECFpSSeQR4Q7ZAe9W5GkOg@mail.gmail.com>

On 12-11-11 7:08 PM, Jake Roth wrote:
> Hi,
>
> I'm new to R and am learning the ropes of r-help and programming.
>
> I'm attempting to plot a 2-D mesh in 3-D using the persp function.  I've
> positioned the graph using phi and theta, but I'm having trouble overlaying
> color onto the actual surface according to the surface's "z" values.  I've
> tried the "col" feature but it doesn't put a flowing color gradient on the
> entire surface...
>
> Additionally, the xlab and ylab labels are appearing squished on the outer
> edges of the chart.  Is there any way to get rid of the arrow along the
> axes and replace them with ticks and labels? "nticks" wasn't working...
>
> Is persp the best way to 3-D plot a 2-D array where I can overlay color??
>
> Any guidance would be greatly appreciated.
>

An alternative is the persp3d function in the rgl package.  It handles 
colour differently from persp:  vertices get colours, rather than 
facets.  That might give you the gradient you want.

Duncan Murdoch