-1
$\begingroup$

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!

$\endgroup$
  • $\begingroup$ Have you tried anything so far? $\endgroup$ – MarcoB May 12 '16 at 5:26
  • $\begingroup$ @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. $\endgroup$ – Mike May 12 '16 at 5:30
  • 1
    $\begingroup$ 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. $\endgroup$ – MarcoB May 12 '16 at 5:34
  • 1
    $\begingroup$ 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? $\endgroup$ – J. M. is away May 12 '16 at 5:36
  • 1
    $\begingroup$ 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. $\endgroup$ – J. M. is away May 12 '16 at 5:40
1
$\begingroup$

J. M.'s comment-answer:

ParametricPlot[{Cos[t], Sin[t]}, {t, -π, π}, 
 ColorFunction -> 
  Function[{x, y, t}, ColorData[{"TemperatureMap", {-1, 1}}, Sin[t]]], 
 ColorFunctionScaling -> False,
 PlotStyle -> Thickness[0.03]
]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.