MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Displaying 3D data as 2D + color

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25689] Re: Displaying 3D data as 2D + color
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Thu, 19 Oct 2000 04:35:17 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Derek Stoll and Axel Could asked how to plot arbitrary points in 3D as
points in 2D points with color showing the magnitude of the z value.  The
code below will work with Version 3, and probably any version of
Mathematica. I could have made the code more elegant if I used features new
in Version 4. Also it would be better to ensure all elements in (data) are
numeric with zero imaginary part, but I left that out for brevity.

-------------

In[1]:=
ColoredListPlot[data:{{_,_,_}...}]:=
  Module[{data2,pnts,HeightValues},
    HeightValues=Last/@data;
    HeightValues=HeightValues/Max[HeightValues];
    data2=Transpose at Join[Take[Transpose[data],2],{HeightValues}];
    pnts={Hue[ 1/3.0,1-0.75Last[#],0.5+0.5Last[#] ],Point[Take[#,2]]}&
/@data2;
    Show[Graphics[{PointSize[0.03],pnts}]]
    ]


In[2]:=
data={{6.04, 8.13, 20.}, {3.76, 9.78, 16.9}, 
 {4.31, 8.51, 11.3}, {4.06, 5.47, 32.4}, 
 {5.98, 8.04, 24.9}, {5.18, 5.09, 48.1}, 
 {2.26, 6.1, 34.5}, {6.52, 3.84, 30.7}, 
 {0.866, 8.39, 49.2}, {2.38, 1.08, 25.}, 
 {5.53, 3.88, 44.1}, {0.94, 0.0587, 36.9}, 
 {2.84, 2.9, 25.4}, {2.21, 7.75, 16.4}, 
 {2.81, 6.11, 4.25}, {6.76, 8.97, 49.8}};


In[3]:=
ColoredListPlot[data];

   (** Graphics not shown  **)


--------------------
Regards,
Ted Ersek

Download Mathematica tips, tricks from 
http://www.verbeia.com/mathematica/tips/Tricks.html




  • Prev by Date: Difficulties EXPORTing graph for prresentation to PDF format
  • Next by Date: Re: Bugs in Abs and Sign !?
  • Previous by thread: Re: Difficulties EXPORTing graph for prresentation to PDF format
  • Next by thread: Help, Please Help: bigotime(s) operator