RE: Help with 3D graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg33853] RE: [mg33846] Help with 3D graphics
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 20 Apr 2002 02:49:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Debbie, You can produce your plot this way: First, you can simplify by making a list of the points you want to plot. points = {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1}}; Now, comes the tricky part. We plot the plane, convert it from SurfaceGraphics to Graphics3D, and extract the primitive graphics which are the first part of the resulting output. We also suppressed the plot display. plane = First[ Graphics3D[ Plot3D[2x + y, {x, 0, 1}, {y, 0, 1}, DisplayFunction -> Identity]]]; We now Show the plane and the points. We obtain the points by mapping Point onto the list of points. (If you are unfamiliar with this, \@ stands for Map. Look up Map in Help.) We pick a ViewPoint that will show the plane and all of the points. Show[ Graphics3D[ {plane, AbsolutePointSize[10], Point /@ points}], Axes -> True, AxesLabel -> {x, y, z}, PlotRange -> {0, 1}, ViewPoint -> {2.941, -1.198, 1.168}, ImageSize -> 500]; It is somewhat easier to do this using the DrawGraphics package, available at my web site. The plane can be drawn directly without sideplots or graphics gymnastics. Needs["DrawGraphics`DrawingMaster`"] Draw3DItems[ {Draw3D[2x + y, {x, 0, 1}, {y, 0, 1}], AbsolutePointSize[10], Point /@ points}, Axes -> True, AxesLabel -> {x, y, z}, PlotRange -> {0, 1}, ViewPoint -> {2.941, -1.198, 1.168}, ImageSize -> 500]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: Debbie Carlini [mailto:dmc522 at earthlink.net] To: mathgroup at smc.vnet.net > > > I am doing a project for school and need to be able to plot a 3D > graph that > goes from 0 to 1 in x, y and z directions. I also need to be > able to plot a > set of 3d points on the same graph as the 3d graph. > Here is what i have so far, the problem is that my second graph > does not go > from 0 to 1 in the z direction like the first graph. I think it is a > problem with converting Plot3D to Graphics3D. > > Show[ > Graphics3D[{ PointSize[0.05], Point[{0, 0, 0}] } ], > Graphics3D[{ PointSize[0.05], Point[{0, 0, 1}] } ], > Graphics3D[{ PointSize[0.05], Point[{0, 1, 0}] } ], > Graphics3D[{ PointSize[0.05], Point[{0, 1, 1}] } ], > Graphics3D[ > Plot3D[2x + y, {x, 0, 1}, {y, 0, 1}, PlotRange -> {0, 1}, > ClipFill -> None ]] > > ] > > Would my problem be solved if i used ScatterPlot3D to plot the > points. The > problem i've found with this is that ScatterPlot3D will not work in Show > command. > > Thanks > >