Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

coloring individual hexagons in a grid...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127869] coloring individual hexagons in a grid...
  • From: Richard Palmer <rhpalmer at gmail.com>
  • Date: Tue, 28 Aug 2012 04:53:02 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

I am using the code shown below to draw square hexagonal grids.

Hexagon[x_]:=Line[x+#&/@(Through[{Cos,Sin}[Pi #/3]]&/@Range[0,6])]

HexagonalGrid[x_,y_]:=Module[{i,j},
Table[Hexagon[{3/2i,Sqrt[3]j+Mod[i,2]Sqrt[3]/2}],{i,x},{j,y}]
]

k;
Show[Graphics[HexagonalGrid[k,k]],
AspectRatio->Automatic]

How does one assign a color to individual cells in the hex grid?
-- 
Richard Palmer

Home                            941 412 8828
Cell                               508 982-7266




  • Prev by Date: Re: Problems obtaining a free c compiler...
  • Next by Date: How to specify x-axis in List when using ListPlot
  • Previous by thread: Locator Bug
  • Next by thread: Re: coloring individual hexagons in a grid...