# How can I draw a 2D circular plot?

I have a function $Q(y)$, which I would like to plot this radially using varying color shades to show the variation in the function. I'm looking for a 2D surface plot, maybe like DensityPlot, but circular and versus one parameter ($y$). An example use case would be plotting the angular velocity of a galaxy with color, assuming that it is radially symmetric.

You can assume an arbitrary $Q(y)$, e.g. $1/y^2$. Now for each $y$, we have a value for $Q(y)$. One way to show the results is to plot $Q(y)$ vs. $y$. But I would prefer if I can have a circular plot where for each $y$ there is a ring where $y$ is constant. I would like the color of this ring to be determined by the value of $Q(y)$.

• Maybe you are looking for PolarPlot? – Henrik Schumacher May 5 '18 at 12:32
• If PolarPlot isn't what you're looking for, do you have an example of what kind of plot you're trying to make? – eyorble May 5 '18 at 13:04
• So what about DensityPlot[Q[Sqrt[x^2+y^2]], {x, -5, 5}, {y, -5, 5}], assuming that $0 \le r \le 5$ is an appropriate range for your plot? – eyorble May 5 '18 at 17:41
• Maybe you are looking for somthing like this: f = r \[Function] 1/2 (1 + Sin[5 Pi r]); ParametricPlot[ r {Cos[t], Sin[t]}, {r, 0, 1}, {t, -Pi, Pi}, ColorFunction -> {{x, y, r, t} \[Function] ColorData["SunsetColors"][f[r]]}, Background -> Black ] – Henrik Schumacher May 5 '18 at 18:50
• @HenrikSchumacher Since you got it right, it would be good if you would post it as an answer so that the question does not formally stay unanswered. I'll give you a +1 if you do it :) – C. E. May 6 '18 at 9:05

It appears to me from the comments that you a looking for this:

f = r \[Function] 1/2 (1 + Sin[5 Pi r]);
ParametricPlot[ r {Cos[t], Sin[t]}, {r, 0, 1}, {t, -Pi, Pi},
ColorFunction -> {{x, y, r, t} \[Function] ColorData["SunsetColors"][f[r]]},
Background -> Black
] DensityPlot can also be used for this by substituting the appropriate expression for radius into the function's argument. For example, assuming that $0 \le r \le 5$ is an appropriate range to plot your function over, you can input:

DensityPlot[Q[Sqrt[x^2+y^2]], {x, -5, 5}, {y, -5, 5}]


You can borrow the ColorFunction and Background from Henrik Schumacher's answer if you prefer, as well.