Skip to main content
added 1023 characters in body
Source Link
halirutan
  • 113.9k
  • 7
  • 269
  • 488

Update

By the way, it is not required to create a new coordinate list for all graphics primitives. This was only done to make the code verbose enough. The color disk, the radial lines and the circles can all be created easily using the same underlying data. Here the Span operator (;;) becomes handy, to achieve high resolution in the color disk, but have only some radial grid lines.

With[{pts = Append[#, First[#]] &@ Table[{r {Cos[phi], Sin[phi]}, phi/(2 Pi)}, {phi, 0, 2 Pi, .1}, {r, 0, 1, .1}]}, Graphics[{Polygon[{{0, 0}, First[#1], First[#2]}, VertexColors -> (Hue /@ {{0, 0, 1}, Last[#1], Last[#2]})] & @@@ Partition[pts[[All, -1, {1, 2}]], 2, 1], Black, Opacity[.5], Line[pts[[;; ;; 3, All, 1]]], Line[Transpose[pts[[All, All, 1]]]], Opacity[.2], {Line[#], Line[Map[Reverse, #, {2}]]} &@ Table[{{x, #}, {x, -#}} &@Sqrt[1 - x^2], {x, -1, 1, .1}] }]] 

enter image description here

Update

By the way, it is not required to create a new coordinate list for all graphics primitives. This was only done to make the code verbose enough. The color disk, the radial lines and the circles can all be created easily using the same underlying data. Here the Span operator (;;) becomes handy, to achieve high resolution in the color disk, but have only some radial grid lines.

With[{pts = Append[#, First[#]] &@ Table[{r {Cos[phi], Sin[phi]}, phi/(2 Pi)}, {phi, 0, 2 Pi, .1}, {r, 0, 1, .1}]}, Graphics[{Polygon[{{0, 0}, First[#1], First[#2]}, VertexColors -> (Hue /@ {{0, 0, 1}, Last[#1], Last[#2]})] & @@@ Partition[pts[[All, -1, {1, 2}]], 2, 1], Black, Opacity[.5], Line[pts[[;; ;; 3, All, 1]]], Line[Transpose[pts[[All, All, 1]]]], Opacity[.2], {Line[#], Line[Map[Reverse, #, {2}]]} &@ Table[{{x, #}, {x, -#}} &@Sqrt[1 - x^2], {x, -1, 1, .1}] }]] 

enter image description here

added 67 characters in body
Source Link
halirutan
  • 113.9k
  • 7
  • 269
  • 488

It is of course possible to draw everything manually.

enter image description here

Manipulate[ With[{ colArea = Polygon[#2, VertexColors -> ConstantArray[Hue[#1/(2 Pi)], 3]] & @@@ Table[{phi, {{0, 0}, {Cos[phi], Sin[phi]}, {Cos[phi + 2 Pi/40]colors],  Sin[phi + 2 Pi/40]colors]}}},  {phi, 0.0, 2 Pi - 2 Pi/colors, 2 Pi/40colors}], gridLines = Table[{{x, -#}, {x, #}} &[Sqrt[1 - x^2]], {x, -1, 1, 2/(grid - 1)}], radLines = Table[{{0, 0}, {Cos[phi], Sin[phi]}}, {phi, 0, 2 Pi - 2 Pi/radiants, 2 Pi/radiants}], cirLines = With[{ circle = Table[{Cos[phi], Sin[phi]}, {phi, 0, 2 Pi, Pi/20}]}, Table[r*circle, {r, 0, 1, 1/circles}] ]}, Graphics[{ colArea, Black, Thin, Line[gridLines], Line[Map[Reverse, gridLines, {2}]], Darker@Gray, Line@radLines, Line /@ cirLines}]], {circles, 3, 10, 1}, {radiants, 4, 20, 1}, {grid, 5, 20, 1}, {{colors, 20}, 4, 120, 1} ] 

It is of course possible to draw everything manually.

enter image description here

Manipulate[ With[{ colArea = Polygon[#2, VertexColors -> ConstantArray[Hue[#1/(2 Pi)], 3]] & @@@ Table[{phi, {{0, 0}, {Cos[phi], Sin[phi]}, {Cos[phi + Pi/40], Sin[phi + Pi/40]}}},  {phi, 0.0, 2 Pi, Pi/40}], gridLines = Table[{{x, -#}, {x, #}} &[Sqrt[1 - x^2]], {x, -1, 1, 2/(grid - 1)}], radLines = Table[{{0, 0}, {Cos[phi], Sin[phi]}}, {phi, 0, 2 Pi - 2 Pi/radiants, 2 Pi/radiants}], cirLines = With[{ circle = Table[{Cos[phi], Sin[phi]}, {phi, 0, 2 Pi, Pi/20}]}, Table[r*circle, {r, 0, 1, 1/circles}] ]}, Graphics[{ colArea, Black, Thin, Line[gridLines], Line[Map[Reverse, gridLines, {2}]], Darker@Gray, Line@radLines, Line /@ cirLines}]], {circles, 3, 10, 1}, {radiants, 4, 20, 1}, {grid, 5, 20, 1} ] 

It is of course possible to draw everything manually.

enter image description here

Manipulate[ With[{ colArea = Polygon[#2, VertexColors -> ConstantArray[Hue[#1/(2 Pi)], 3]] & @@@ Table[{phi, {{0, 0}, {Cos[phi], Sin[phi]}, {Cos[phi + 2 Pi/colors],  Sin[phi + 2 Pi/colors]}}}, {phi, 0, 2 Pi - 2 Pi/colors, 2 Pi/colors}], gridLines = Table[{{x, -#}, {x, #}} &[Sqrt[1 - x^2]], {x, -1, 1, 2/(grid - 1)}], radLines = Table[{{0, 0}, {Cos[phi], Sin[phi]}}, {phi, 0, 2 Pi - 2 Pi/radiants, 2 Pi/radiants}], cirLines = With[{ circle = Table[{Cos[phi], Sin[phi]}, {phi, 0, 2 Pi, Pi/20}]}, Table[r*circle, {r, 0, 1, 1/circles}] ]}, Graphics[{ colArea, Black, Thin, Line[gridLines], Line[Map[Reverse, gridLines, {2}]], Darker@Gray, Line@radLines, Line /@ cirLines}]], {circles, 3, 10, 1}, {radiants, 4, 20, 1}, {grid, 5, 20, 1}, {{colors, 20}, 4, 120, 1} ] 
Source Link
halirutan
  • 113.9k
  • 7
  • 269
  • 488

It is of course possible to draw everything manually.

enter image description here

Manipulate[ With[{ colArea = Polygon[#2, VertexColors -> ConstantArray[Hue[#1/(2 Pi)], 3]] & @@@ Table[{phi, {{0, 0}, {Cos[phi], Sin[phi]}, {Cos[phi + Pi/40], Sin[phi + Pi/40]}}}, {phi, 0.0, 2 Pi, Pi/40}], gridLines = Table[{{x, -#}, {x, #}} &[Sqrt[1 - x^2]], {x, -1, 1, 2/(grid - 1)}], radLines = Table[{{0, 0}, {Cos[phi], Sin[phi]}}, {phi, 0, 2 Pi - 2 Pi/radiants, 2 Pi/radiants}], cirLines = With[{ circle = Table[{Cos[phi], Sin[phi]}, {phi, 0, 2 Pi, Pi/20}]}, Table[r*circle, {r, 0, 1, 1/circles}] ]}, Graphics[{ colArea, Black, Thin, Line[gridLines], Line[Map[Reverse, gridLines, {2}]], Darker@Gray, Line@radLines, Line /@ cirLines}]], {circles, 3, 10, 1}, {radiants, 4, 20, 1}, {grid, 5, 20, 1} ]