Example 11
ScatterPlot4D
GIVEN: 4-D data (x1,x2,x3,x4)
REQUIRED: Plot the data
SOLUTION:Generate example11.nb
Needs["Graphics`Graphics3D`"]
ScatterPlot4D[data_ /;
MatrixQ[data, NumberQ] &&
Length[First[data]] ===4,
fun_, opts___] :=
Module[{res, coord},
coord = Map[Last, data] ;
min = Min[coord] ;
max = Max[coord] ;
Show[Graphics3D[
Map[
{
fun[(Last[#] - min)/(max-min)],
Point[Take[#, 3]]
}&, data], opts]]
]
(
rnd := 2 Random[ ] -1;
data = Table[{xvar = rnd, yvar = rnd, zvar = rnd,
Abs[xvar yvar zvar]}, {100}];
)
ScatterPlot4D[data, GrayLevel]
Example
Homework:
Add Color
ScatterPlot4D[data, RGBColor[#, 1-#,1]&]
Plot Cuboid primitives
Show[% /. Point[pt_] :> Cuboid[pt, pt+{0.1,0.1,0.1}], Lighting -> False]
Please send questions or suggestions about this web page to beatnic@aset.psu.edu
ASET | ITS | Penn State
|