Sam Yeaman
2008-Sep-30 21:20 UTC
[R] adding planes/lines to 3d surface plots? (persp, wireframe)
Dear helplist members, I have been using 'wireframe()' to make 3d plots using the following call: wireframe (temp ~ xc2 * mc2, screen = list(z = 230, x = -70, y = 0), scales = list (arrows = FALSE)) and these three vectors: xc2 mc2 temp [1,] 0.1 0.04 0.049797615 [2,] 0.2 0.04 0.049161159 [3,] 0.3 0.04 0.048006702 [4,] 0.4 0.04 0.046208311 [5,] 0.5 0.04 0.043621147 [6,] 0.1 0.08 0.047349612 [7,] 0.2 0.08 0.039975856 [8,] 0.3 0.08 0.029568382 [9,] 0.4 0.08 0.018639133 [10,] 0.5 0.08 0.009687882 [11,] 0.1 0.12 0.046551498 [12,] 0.2 0.12 0.037196351 [13,] 0.3 0.12 0.024773644 [14,] 0.4 0.12 0.013159600 [15,] 0.5 0.12 0.005318355 [16,] 0.1 0.16 0.046155843 [17,] 0.2 0.16 0.035859584 [18,] 0.3 0.16 0.022614680 [19,] 0.4 0.16 0.010974976 [20,] 0.5 0.16 0.003884974 [21,] 0.1 0.20 0.045919545 [22,] 0.2 0.20 0.035074424 [23,] 0.3 0.20 0.021392682 [24,] 0.4 0.20 0.009820538 [25,] 0.5 0.20 0.003205077 I would like to add a horizontal plane to this figure, with a z-intercept at 0.02, to indicate a cut-off point of scientific interest. Alternatively, I could add a line highlighting every point where the surface passes through z = 0.02. If anyone has any ideas how to do this (using persp (), wireframe() or something else), I would greatly appreciate it. The closest thing I can think of is to use scatterplot3d() and then add a plane3d object, but I'd like to have a surface rather than a point cloud. I got two surfaces to appear using persp() and par (new = TRUE), but the second surface obscures the first. Thanks, Sam Yeaman UBC Department of Zoology