Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: coloring individual hexagons in a grid...
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Richard Palmer

Posts: 46
Registered: 7/31/06
coloring individual hexagons in a grid...
Posted: Aug 28, 2012 4:51 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.