# How to construct my own ColorFunction with the TemperatureMap range

I would like to draw the unit circle and define my own coloring function on it so that every point $e^{i\theta}$ of the unit circle will be colored according to said function from the range of colors TemperatureMap.

For example, let's say I want to color every point on the unit circle according to a function (which I call "color"), in the following manner:

$color(e^{i\theta})=Sin(\theta)$

This means that the point $e^{i\theta}$ with the value $\theta$ such that $Sin(\theta)$ takes its greatest value, in this case $\theta=\pi/2$, will be the deepest red, and accordingly for the rest of the points.

Any help is much appreciated!

• Have you tried anything so far? – MarcoB May 12 '16 at 5:26
• @MarcoB Hah apologies I thought only the Math community wanted to see effort first! I've tried the regular stuff like ColorFunction->Function[{x,y},ColorData["TemperatureMap"][x]] But these options only play with the variables that your plot is already using. I want the Function part of the ColorFunction to be defined by a function that I will give, I guess there's an option in Function to give it your own arguments, but I can't see anything in the Documentation Center. I figured somebody who knows about RGB stuff could answer this on a whim. – Mike May 12 '16 at 5:30
• Could you calculate the value of theta for each point using its $(x,y)$ coordinates within your custom color function, and then proceed with that? Perhaps VectorAngle could help you here. – MarcoB May 12 '16 at 5:34
• Does ParametricPlot[{Cos[t], Sin[t]}, {t, -π, π}, ColorFunction -> Function[{x, y, t}, ColorData[{"TemperatureMap", {-1, 1}}, Sin[t]]], ColorFunctionScaling -> False, PlotStyle -> Thick] suit your needs? – J. M. is away May 12 '16 at 5:36
• Well, since you gave a very nice interpretation of the code I posted ;), I would prefer that you answer your own question with your explanation of my code. :) (I promise to upvote.) BTW: ColorData[] only takes two arguments. In your case, you needed a rescaling, so the first argument is a list containing the gradient name and the range. – J. M. is away May 12 '16 at 5:40

ParametricPlot[{Cos[t], Sin[t]}, {t, -π, π},