Re: Special 3D Plots
- To: mathgroup at smc.vnet.net
- Subject: [mg19792] Re: Special 3D Plots
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 17 Sep 1999 01:36:46 -0400
- References: <7rnkjg$em9@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Lindsay Magnus <l.magnus at ru.ac.za> wrote in message news:7rnkjg$em9 at smc.vnet.net... > I need some advice to try and create a special plot. I want to give > mathematica a data file that contains 3D data. In this I mean that > every datum point has three values associated with it. (x,y and z for > example). I want to plot a graph where the x-axis is given by the x > value, the y-axis is given by the y value and the color of the block at > co-ordinates (x,y) is given by the z value. > > thanx for the time > lins > > Lins, The crucial point is to convert each triple {x,y,z} into {cf[z],Point[{x,y}]}, where cf is a function (color function) thart takes z and returns a color directive. coloredPoints[data_, cf_] := Show[Graphics[{PointSize[.02], Apply[{cf[#3], Point[{#1, #2}]} &, data, {1}]}]] In Mathematica 4.0 we can abreviate this to coloredPoints[data_, cf_] := Show[Graphics[{PointSize[.02], {cf[#3], Point[{#1, #2}]} & @@@ data}]] Try data = Table[Random[], {50}, {3}]; coloredPoints[data, Hue[.67#] &]; Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565