yabado
2008-Sep-23 17:16 UTC
[R] How to draw arrows or segment lines in 3 dimensional graph
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.
Yihui Xie
2008-Sep-24 04:17 UTC
[R] How to draw arrows or segment lines in 3 dimensional graph
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. >
Reasonably Related Threads
- How to convert a matrix to a dataframe and makes its first row be the column name
- transform(_data,...) using strptime gives an error
- data format issue
- Howto Draw Bimodal Gamma Curve with User Supplied Parameters
- multi-regression with more than 50 independent variables