Skip to main content

graphics - How can I generate and randomly assign color to annular sectors?


enter image description here


How can I generate such an image and fill every annular sector with a random colour?



Answer



With V10 came RandomColor and ColorSpace



Using Michael E2's wonderful solution


plot =
ParametricPlot[r {Cos[t], Sin[t]}, {r, 0, 12}, {t, 0, 2 Pi},
ImageSize -> 500,
Mesh -> 13,
MeshShading -> {{Red, Red}, {Red, Red}},
PlotRange -> {{-9, 9}, {-4, 4}}];

Grid @ Partition[Table[plot /.
poly_Polygon :> {RandomColor[ColorSpace -> space], poly},

{space, {"RGB", "XYZ", "CMYK", "Grayscale"}}], 2]

enter image description here


Comments