Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11568

Re: coloring individual hexagons in a grid...

From Richard Palmer <rhpalmer@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: coloring individual hexagons in a grid...
Date 2012-08-31 08:02 +0000
Message-ID <k1pr22$k12$1@smc.vnet.net> (permalink)
References <20120828085302.9525568C1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Thanks Bob,  However, I am trying to color the interior of the hexagons,
not the edges.

On Wed, Aug 29, 2012 at 11:26 PM, Bob Hanlon <hanlonr357@gmail.com> wrote:

> Hexagon[x_] :=
>  Line[x + # & /@
>    (Through[{Cos, Sin}[Pi #/3]] & /@
>      Range[0, 6])]
>
> HexagonalGrid[nbrRows_, nbrColumns_,
>   colorFunction_: Null] :=
>  Module[{i, j},
>   Table[{
>     If[colorFunction === Null,
>      Black,
>      colorFunction[i, j]],
>     Hexagon[
>      {3/2 j, Sqrt[3] i + Mod[j, 2] Sqrt[3]/2}]}, {i, nbrRows}, {j,
>     nbrColumns}]]
>
> With[{k = 3},
>  Show[Graphics[
>    HexagonalGrid[k, k]],
>   AspectRatio -> Automatic]]
>
> With[{k = 3},
>  Show[Graphics[
>    HexagonalGrid[k, k, Hue[
>       Rescale[#1 + #2, {2, 2 k}]] &],
>    AspectRatio -> Automatic]]]
>



-- 
Richard Palmer

Home                            941 412 8828
Cell                               508 982-7266

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: coloring individual hexagons in a grid... Richard Palmer <rhpalmer@gmail.com> - 2012-08-31 08:02 +0000

csiph-web