[R] How to draw arrows or segment lines in 3 dimensional graph

Yihui Xie xieyihui at gmail.com
Wed Sep 24 06:17:49 CEST 2008


Hi,

You need to converts coordinates from 3D (x, y, z) to 2D-projection
(x, y), then use segments or arrows or other 2D low-level plot
commands. Such transformation functions are very common in the
returned value of a 3D plot function, e.g. scatterplot3d() in the
package 'scatterplot3d' (there's a function xyz.convert() in the value
returned). See 'trans3d()' in 'grDevices' to know more about the
transformation.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Wed, Sep 24, 2008 at 1:16 AM, yabado <alexhsi1123 at hotmail.com> wrote:
>
> Hi
>
> I have a dataset which is like this:
> ID      X1      Y1      Z1      X2      Y2      Z2
> 1       32      127     85      31.7    121     85
> 2       37.9    153     88      34.6    137     90
> 3       36.8    134     88      36.1    155     97
> 4       31.4    136     87      29      113     70
>
>
> I would like draw the arrow or segment line for each ID from (x1, y1, z1) to
> (x2, y2, z2)
> Is there a way to do this kind of 3-D graph.
>
> Thank you
> --
> View this message in context: http://www.nabble.com/How-to-draw-arrows-or-segment-lines-in-3-dimensional-graph-tp19632610p19632610.html
> Sent from the R help mailing list archive at Nabble.com.
>



More information about the R-help mailing list