I generated an array of circles/disks with an hexagonal packing. Now I want to give each circle/disk a color depending on the value of a second list.
Table 1: Coordinates of disks
1.) (x1/y1)
2.) (x2/y2)
3.) (x3/y3)
4.) (x4/y4)
...
Table 2: Colors
(Blue)
(Red)
(Green)
(Blue)
...
NumberRows = 10;
NumberColumns = 10;
Table1 = Table[{0.5 + i, 0.5 + (2*j*Sqrt[1 - 0.5^2])}, {i, 0,
NumberColumns - 1}, {j, 0, ((NumberRows - 2)/2)}];
Table2 = Table[{i, 0.5 + ((1 + 2*j)*Sqrt[1 - 0.5^2])}, {i, 0,
NumberColumns - 1}, {j, 0, ((NumberRows - 2)/2)}];
TableCombined = Join[Table1, Table2];
g3 = Flatten[TableCombined, 1];
points = Graphics[{Blue , Disk[#, 0.5] & /@ g3}];
Show[points, Frame -> True]
disks = MapThread[{#1, Disk[#2, 0.5]}&, {listOfColors, g3}]; Graphics [disks, Frame -> True]
. Note thatlistOfColors
should have the same length asg3
. $\endgroup$