Student Support Forum: 'ScatterPlot3D' topicStudent Support Forum > General > "ScatterPlot3D"

 < Previous Comment Help | Reply To Comment | Reply To Topic
 Author Comment/Response Forum Moderator email me 09/28/99 07:17am >I am trying to plot a data set {x,y,z} with the color of the point calculated by Sqrt[x^2 + y^2 + z^2]. I am trying to use the Hue[h] function since I know that it is cyclic. ===== You might try constructing your own points with color and other directives. Here is a random set of points: In[10]:= xyzcoords=Table[{Random[],Random[],Random[]}, {10}] Out[10]={{0.915568,0.459252,0.314224},{0.202207,0.638274,0.82676},{0.457012,0.316369, 0.0488907},{0.296286,0.357261,0.0308598},{0.69779,0.819632,0.854321},{ 0.352389,0.0439262,0.974541},{0.455583,0.505874,0.816139},{0.0265835, 0.844555,0.287832},{0.900571,0.567331,0.530331},{0.085625,0.262297, 0.740572}} Here is a function that matches your color function. Note that this function will always return a result between 0 and 1 (the maximum value of x^2+y^2+z^2 is 3) as required by Hue. In[12]:= colorf[{x_, y_, z_}]:= Sqrt[x^2+y^2+z^2]/Sqrt[3] Here is the color value of the first point in the list. In[13]:= colorf[ xyzcoords[[1]]] Out[13]= 0.618578 Here is a set of graphics expressions that include a color for each point, a PointSize increase for visibility and the Point primitive itself. In[17]:= xyzpoints= Table[{Hue[colorf[xyzcoords[[i]]]],PointSize[.02], Point[xyzcoords[[i]]]}, { i, 1, Length[xyzcoords]}] Out[17]= {{Hue[0.618578],PointSize[0.02],Point[{0.915568,0.459252,0.314224}]},{ Hue[0.614224],PointSize[0.02],Point[{0.202207,0.638274,0.82676}]},{ Hue[0.322149],PointSize[0.02],Point[{0.457012,0.316369,0.0488907}]},{ Hue[0.26856],PointSize[0.02],Point[{0.296286,0.357261,0.0308598}]},{ Hue[0.793426],PointSize[0.02],Point[{0.69779,0.819632,0.854321}]},{ Hue[0.598843],PointSize[0.02],Point[{0.352389,0.0439262,0.974541}]},{ Hue[0.613609],PointSize[0.02],Point[{0.455583,0.505874,0.816139}]},{ Hue[0.515373],PointSize[0.02],Point[{0.0265835,0.844555,0.287832}]},{ Hue[0.686572],PointSize[0.02],Point[{0.900571,0.567331,0.530331}]},{ Hue[0.456281],PointSize[0.02],Point[{0.085625,0.262297,0.740572}]}} These points can displayed as follows: In[18]:= Show[Graphics3D[xyzpoints]] Information on graphics primitives and directives can be found in the Mathematica Help Browser. Tom Zeller Forum Moderator URL: ,

 Subject (listing for 'ScatterPlot3D') Author Date Posted ScatterPlot3D Elvis Dieguez 09/24/99 07:23am Re: ScatterPlot3D Elvis Dieguez 09/26/99 4:45pm Re: ScatterPlot3D Forum Modera... 09/28/99 07:21am Re: ScatterPlot3D Forum Modera... 09/28/99 07:17am
 < Previous Comment Help | Reply To Comment | Reply To Topic