Re: Displaying 3D data as 2D + color ?
- To: mathgroup at smc.vnet.net
- Subject: [mg25183] Re: Displaying 3D data as 2D + color ?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 12 Sep 2000 21:24:26 -0400 (EDT)
- References: <8pkka3$m39@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Axel,
Here is first try - the color function should be given in an option and the
plot should be styled by an option.
The crucial point is to separate out the xy and the z coordinates.
data = Table[Random[Real, {-1, 5}], {100}, {3}];
colorByZ[data_, colorfn_] :=
Module[{zs, zmin, zmax, scale},
zs = data[[All, 3]];
zmin = Min[zs];
zmax = Max[zs];
scale[z_] = (z - zmin)/(zmax - zmin);
Show[
Graphics[{PointSize[.03],
Transpose[
{colorfn[scale[#]] & /@ data[[All, 3]],
Point /@ data[[All, {1, 2}]]}]}],
PlotRange -> All
]
]
colorByZ[data, Hue[.7 #] &]
--
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
"Axel Kowald" <axel at itb.biologie.hu-berlin.de> wrote in message
news:8pkka3$m39 at smc.vnet.net...
> Hello,
>
> I got numerical 3D data (x,y,z coordinates) which are NOT lying on a
> grid, but are scattered. I would like to plot them as 2D with the color
> of the points indicating the z value. It seems the standard Mathematica
plotting
> commands can't do that :-(
> But I'm sure there must be a package for this problem.
>
> Any hint is welcomed,
>
> Axel
>
> --
> -----------------------------------------------------------------
> Dr. A. Kowald
> Innovationskolleg Theoretische Biologie
> Humboldt University Berlin
> Invalidenstr. 43
> 10115 Berlin
> Germany
>
> Email: a.kowald at itb.biologie.hu-berlin.de
> http://itb.biologie.hu-berlin.de/~axel
> Phone: +49 30 2093 9105
> Fax: +49 30 2093 8801
> -----------------------------------------------------------------
>