MathGroup Archive 2008

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

Search the Archive

Re: Re: Voronoi diagram colours


In my previous reply, I didn't read completely the requirement of the
sender of the question.  The correct one is as follows.

<< ComputationalGeometry`

data2D = {{4.4, 14}, {6.7, 15.25}, {6.9, 12.8}, {2.1, 11.1}, {9.5,
    14.9}, {13.2, 11.9}, {10.3, 12.3}, {6.8, 9.5}, {3.3, 7.7}, {0.6,
    5.1}, {5.3, 2.4}, {8.45, 4.7}, {11.5, 9.6}, {13.8, 7.3}, {12.9,
    3.1}, {11, 1.1}};

{vorvert, vorval} =
  BoundedDiagram[{{0, 1}, {14, 1}, {14, 16}, {0, 16}}, data2D];

(* If you use system color codes such as "Rainbow" *)
{ColorData["Rainbow"][Length[#]/10],
    Polygon[#]} & /@ (vorvert[[#]] & /@ (#[[2]] & /@
      vorval)) // Graphics

(* Or, if you use your own color codes *)

myColors = { Red,  Green, Cyan, Blue};

cgraphics = {myColors[[Length[#] - 3]],
     Polygon[#]} & /@ (vorvert[[#]] & /@ (#[[2]] & /@ vorval)) //
  Graphics

(* After colorling, you can complete the diagram combining with edges *)

dgraphics = DiagramPlot[data2D, vorvert, vorval]

Show[{cgraphics, dgraphics}]



Takashi YOSHINO wrote:
> << ComputationalGeometry`
> 
> data2D = {{4.4, 14}, {6.7, 15.25}, {6.9, 12.8}, {2.1, 11.1}, {9.5,
>     14.9}, {13.2, 11.9}, {10.3, 12.3}, {6.8, 9.5}, {3.3, 7.7}, {0.6,
>     5.1}, {5.3, 2.4}, {8.45, 4.7}, {11.5, 9.6}, {13.8, 7.3}, {12.9,
>     3.1}, {11, 1.1}};
> 
> {vorvert, vorval} =
>   BoundedDiagram[{{0, 1}, {14, 1}, {14, 16}, {0, 16}}, data2D];
> 
> {ColorData["Rainbow"][RandomReal[]],
>     Polygon[#]} &  /@ (vorvert[[#]] & /@ (#[[2]] & /@
>       vorval)) // Graphics
> 
> 
> Fleck, Stefan wrote:
>> Dear Mathematica-users,
>>
>>
>>
>> I would like to add specific colours to a DiagramPlot of a voronoi diagram.
>> The colours should be given depending on the number of each point in the
>> vertex adjacency list, but I don't find a way to access the colour definition
>> of the polygons. If there is no way to do this with DiagramPlot, does any
>> other possibility exist?
>>
>>
>>
>> With kind regards,
>>
>>
>>
>> Stefan Fleck
>>
>>
>>
>> ***********************************************
>>
>>
>>
>> Stefan Fleck, research co-ordinator, Ph.D.
>>
>> Plant Ecology
>> Albrecht-von-Haller-Institute for Plant Sciences
>> University of G=F6ttingen
>> Untere Karsp=FCle 2
>> 37073 G=F6ttingen
>>
>>
>>
>> Tel. +49-551-3912178
>>
>> Fax +49-551-395701
>>
>>
> 
> 


-- 
Takashi Yoshino
Katachi Wiki: $BC/$b$,;22C$G$-$k7A$N2J3X%[!<%`%Z!<%8(B
http://www.random-walk.org/katachi/
katachiML: $B7A$N2J3X$K$D$$$F5DO@$9$k%a!<%j%s%0%j%9%H(B
http://www.random-walk.org/katachi/index.php?KatachiML


  • Prev by Date: Re: Find Upper Neighbor in a list
  • Next by Date: Re: Asking NN Backpropagation Using MATHEMATICA ver5.0
  • Previous by thread: Re: Voronoi diagram colours
  • Next by thread: Asking NN Backpropagation Using MATHEMATICA ver5.0