Firstly, I'm not asking about blending a color gradient on a curve.
I would like to make the curve color uniform on all its lenght instead, but the color should change dynamically while we slide a Manipulate slider. Secondly, the colors should be from the "Rainbow" color palette, going from "deep red" when the T parameter (temperature) takes its lowest value, and the color should gradually change to the "deep purple" color when T takes its highest value.
Here's a MWE example that shows the idea, using a simple variation of color linked to the temperature (I hope the idea is clear) :
color[T_] := RGBColor[1 (10 - T)/(10 - 1), 0, 1 (T - 1)/(10 - 1)]
Planck[T_, colorparameter_] := Plot[
(1/lambda)^5/(Exp[100/(T lambda)] - 1),
{lambda, 0, 10},
PlotPoints -> Automatic,
PlotRange -> All,
PlotStyle -> Directive[Thick, colorparameter],
PerformanceGoal -> "Quality"
]
Manipulate[
Show[
{Planck[T, color[T]]},
PlotRange -> All,
AspectRatio -> 1,
Frame -> True,
ImageSize -> {400, 400}
],
{
{T, 5, Style["T ( K ) ", 10]},
1, 10, 0.1,
ImageSize -> Large
},
ControlPlacement -> Bottom
]
Currently, the function color[T_]
is not the proper one. It should be changed to something that uses the "Rainbow" palette.
Manipulate[Plot[x^2, {x, 0, 2}, PlotStyle -> ColorData[{"Rainbow", "Reverse"}, a]], {a, 0, 1}]
work for you? $\endgroup$color[T_] = ColorData[{"Rainbow", "Reverse"}][(T - 1)/9];
sinceT
goes from 1 to 10. $\endgroup$ColorData[{"Rainbow", "Reverse"}] is not a graphics directive.
. I believe that "Reverse" is unknown (not sure). $\endgroup$color[T_] = ColorData["Rainbow"][(T - 1)/9];
is working, but the colors are inverted. $\endgroup$ColorData[]
to accept domains?Manipulate[Plot[x^2, {x, 0, 2}, PlotStyle -> ColorData[{"Rainbow", {10, 1}}, a]], {a, 1, 10}]
. $\endgroup$