How do I draw a Circular Graph colored like this in Mathematica?
Here's a start. I'll leave the labeling and fine tuning the details to you:
With[{thin = {Thin, Opacity[0.4]}},
RegionPlot[x^2 + y^2 <= 1, {x, -1, 1}, {y, -1, 1},
ColorFunction -> (Hue[ArcTan[#, #2]/(2 π)] &),
ColorFunctionScaling -> False, PlotPoints -> 100, Frame -> False,
Mesh -> {21, 21, 10, 7, 47}, MeshStyle -> {thin, thin, thin, thin, thin},
MeshFunctions -> {# &, #2 &, Norm[{#1, #2}] &, ArcTan[# , #2] &, ArcTan[# , #2] &}
]
]
Just for fun, only the color wheel drawing part done with Disk
sectors:
With[{sectors = 360},
angle = 2 Pi/sectors;
Graphics[
Table[{Hue[i/sectors], EdgeForm[{Thick, Hue[i/sectors]}],
Disk[{0, 0}, 1, {i angle, (i + 1) angle}]}, {i, 0, sectors - 1}]]]
I had to use a thick EdgeForm
because without it I was getting a moiré pattern in the rendering.
I set out to do this differently from R.M, but I ended up with something very similar. Nevertheless, I think there is a certain simplicity that results from my using ParametricPlot
, so here it is:
ParametricPlot[
r {Cos[t], Sin[t]}, {t, 0, 2 Pi}, {r, 0, 1},
Axes -> False, Frame -> False,
Mesh -> {47, 11, {0}, 8, 27, 27},
MeshFunctions -> {#3 &, #3 &, #3 &, #4 &, # &, #2 &},
MeshStyle -> ({#, #2, #2, #, #, #} &[Opacity[0.5], Thick]),
ColorFunction -> (Hue[#3 - 1/12] &)
]
A complication that arose with this method is that I needed to specifically add the line at zero (that is, east), as I could not get Mesh
to do this automatically.