# How to efficiently make this color wheel?

The best approach I can find is the following:

ClearAll[color];
color[a_,b_]:=Piecewise[{{Hue[1/2-Arg[a+b I]/(2\[Pi]),1,1],0.8<Norm[{a,b}]<1.0},{White,True}}];
Graphics[Flatten[Table[{color[a,b],Rectangle[{a,b},{a+0.05,b+0.05}]},{a,-1,1,0.05},{b,-1,1,0.05}]]]


This approach is very inefficient if I use enough rectangles to make the circles look smooth. It seems there must be a better way using ParametricPlot, RegionPlot, ComplexPlot, ColorFunction, etc. Can you find a better way?

Consider, for instance:

RegionPlot[
Element[{x, y}, Annulus[{0, 0}, {0.8, 1}]], {x, -1, 1}, {y, -1, 1},
Frame -> False, BoundaryStyle -> None,
ColorFunctionScaling -> False,
ColorFunction -> (Hue[1/2 - Arg[#1 + #2 I]/(2 Pi)] &)]


Without ColorFunctionScaling -> False x and y are scaled to $$[0, 1]$$... which can be a bit surprising if you don't remember this functionality. :)

As a side note, ComplexPlot can do the same, but interestingly enough RegionFunction doesn't really work particularly well with it.

EDIT:

Inspired by @Syed, you can also accomplish the same with the following:

ComplexRegionPlot[0.8 < Abs[z] < 1, {z, 1},
Frame -> False, BoundaryStyle -> None,
ColorFunction -> (Hue[-#4] &)]


It is, by the way, the same as this:

ComplexRegionPlot[0.8 < Abs[z] < 1, {z, 1},
Frame -> False, BoundaryStyle -> None,
ColorFunctionScaling -> False,
ColorFunction -> (Hue[1/2 - #4/(2 Pi)] &)]


Oftentimes I find the way colour function scaling works in Mma regarding coordinates more confusing than useful; #4 is clearly the argument of z, but with scaling it runs from $$0$$ to $$1$$ - but it's not that it would have been just divided by $$2\pi$$, no, it again depends on the actual plotted region...

• that's very nice! Jan 19, 2023 at 17:09
ComplexRegionPlot[0.75 < Abs[z] < 1
, {z, -1 - I, 1 + I}
, BoundaryStyle -> None
, ColorFunction -> (Hue[#4] &)
, Frame -> False
]


OR

DensityPlot[Arg[x + I y]
, {x, y} ∈ Annulus[{0, 0}, {0.75, 1}]
, Exclusions -> None
, ColorFunction -> Hue
, ImageSize -> 300
, PlotPoints -> 50
, MaxRecursion -> 3
, Frame -> False
]


OR

PieChart[ConstantArray[1, 360]
, SectorOrigin -> {{π, 1}, 3}
, ChartStyle -> {
EdgeForm[None]
, (Hue[#] & /@ Range[0, 1, 1/360])}
]


• Ah, ComplexRegionPlot behaves better than ComplexPlot with RegionFunction! Jan 19, 2023 at 18:25
• BTW, you can replace {z, -1 - I, 1 + I} with {z, 1}. Jan 19, 2023 at 18:32
• I saw the colors on 0 and $\pi$ and missed their circular progression. This can be fixed using: -Arg[x + I y] in the first solution, ColorFunction -> (Hue[-#4] &) as pointed out by @kirma and using SectorOrigin -> {{\[Pi], -1}, 3} in the PieChart solution.
– Syed
Jan 19, 2023 at 19:14
• @ Syed, Very good, but the graphic is upside down. Jan 20, 2023 at 20:14