Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Special 3D Plots

  • To: mathgroup at
  • Subject: [mg19792] Re: Special 3D Plots
  • From: "Allan Hayes" <hay at>
  • Date: Fri, 17 Sep 1999 01:36:46 -0400
  • References: <7rnkjg$>
  • Sender: owner-wri-mathgroup at

Lindsay Magnus <l.magnus at> wrote in message
news:7rnkjg$em9 at
> 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


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_] :=
        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}]]


data = Table[Random[], {50}, {3}];

coloredPoints[data, Hue[.67#] &];

Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

  • Prev by Date: Re: simple Simplify[] question
  • Next by Date: Re: Some problems with DSolve and NDSolve
  • Previous by thread: Special 3D Plots
  • Next by thread: SUMMARY: NIntegrate: <XXX> should be a machine-size complex...