MathGroup Archive 2012

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

Search the Archive

coloring individual hexagons in a grid...


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...