MathGroup Archive 2011

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

Search the Archive

Re: Coloring a ListSurfacePlot3D with a n x 4 matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118262] Re: Coloring a ListSurfacePlot3D with a n x 4 matrix
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 19 Apr 2011 06:56:08 -0400 (EDT)

The ColorFunction must be defined for all values of {x,y,z} not just discrete values.

points = Flatten[Table[
    {x, y, 1 - x - y, (x - 1/2)^2 + (y - 1/2)^2},
    {x, 0, 1, 1/4}, {y, 0, 1, 1/4}], 1];

knots = Most /@ points;

colorF = Function[{x, y, z},
   ColorData["GreenBrownTerrain"][
    (x - 1/2)^2 + (y - 1/2)^2]];

ListSurfacePlot3D[knots, ColorFunction -> colorF]


Bob Hanlon

---- David Kahle <david.kahle at gmail.com> wrote: 

=============
Hi all -

I have a matrix whose rows, 4 dimensional vectors, represent (x, y, z)  
values as well as a measurement f which I would like to use to create  
an interpolated surface colored according to the value of f.   
ListSurfacePlot3D gives me the appropriate surface (when I strain out  
the x, y, z values), but I'm having a hard time coloring it.  I've  
tried basic stuff with ColorFunction to no avail, but I'm sure this is  
a simple task.  Ideas?  Small example below.


Points = Flatten[
    Table[{x, y, 1 - x - y, (x - 1/2)^2 + (y - 1/2)^2}, {x, 0, 1,  
1/4}, {y, 0,
      1, 1/4}], 1];
N[Points[[1 ;; 5]]]

Knots = Map[Take[#, {1, 3}] &, Points];
N[Knots[[1 ;; 5]]]

ListSurfacePlot3D[Knots] (* Works fine, how to I color the surface? *)

Colorf = Function[{x, y, z},  ColorData["GreenBrownTerrain"][
     Points[[ Position[Knots, {x, y, z}][[1]] ]][[1]][[4]]
]];
ListSurfacePlot3D[Knots, ColorFunction -> Colorf]


Many thanks
david.

----------------------------------
----------------------------------
David Kahle
Rice University
Rm. 1041 Duncan Hall
Department of Statistics, MS 138
6100 Main St.
Houston, TX 77005
http://sites.google.com/site/davidkahle




  • Prev by Date: Re: Another AppendTo replacement problem
  • Next by Date: Re: Histogram using FrequencyData in V7?
  • Previous by thread: Coloring a ListSurfacePlot3D with a n x 4 matrix
  • Next by thread: Re: Coloring a ListSurfacePlot3D with a n x 4 matrix