Re: Re: Voronoi diagram colours
- To: mathgroup at smc.vnet.net
- Subject: [mg85077] Re: [mg85053] Re: [mg85043] Voronoi diagram colours
- From: Takashi Yoshino <tyoshino at toyonet.toyo.ac.jp>
- Date: Sun, 27 Jan 2008 05:46:09 -0500 (EST)
- References: <200801251003.FAA28795@smc.vnet.net> <200801260958.EAA21002@smc.vnet.net>
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
- References:
- Voronoi diagram colours
- From: "Fleck, Stefan" <sfleck@gwdg.de>
- Re: Voronoi diagram colours
- From: Takashi YOSHINO <tyoshino@toyonet.toyo.ac.jp>
- Voronoi diagram colours