Re: help with 3D scatter plot
- To: mathgroup at smc.vnet.net
- Subject: [mg41930] Re: help with 3D scatter plot
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 10 Jun 2003 04:47:00 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <bbroh0$j3e$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, data = Table[(xx = 2*Random[]; yy = 2*Random[]; {xx, yy, Sin[xx*yy]}), {100}]; fitfun = Chop[Fit[data, {1, x, y, x*y}, {x, y}]]; Block[{$DisplayFunction = Identity}, g1 = Plot3D[Evaluate[fitfun], {x, 0, 2}, {y, 0, 2}]; g2 = Graphics3D[{ {AbsolutePointSize[4], Point /@ data}, Line[{Append[Take[#, 2], 0], #}] & /@ data} ]; ] Show[g1, g2] Regards Jens seferiad wrote: > > Hello, > I have Mathematica 4 and have two questions. > 1) I have a 3D scatter plot, and I would like to do a least squares fit to > the data, and display the R^2 value. Since the graph is 3D, the curve fit > should be a surface. I don't think I can do this conveniently, has anyone > found a work around for this? > > 2) Also, it is difficult to visualize the location of the data in the plot, > with or without the grids. I once saw another graph (it may have been Igor > software?) in which each of the data points were attached to lines that were > parallel to the z-axis and stopped at the x-y plane. This is a very nice > feature. Is there something equivalent in Mathematica to help improve with > being able to visualize the graph? Thanks, Jay