The following plot (A)
ListLinePlot[{0,1,2,3},ColorFunction->"TemperatureMap"]
goes from blue to read.
The following plot (B)
ListLinePlot[{4,5,6,7},ColorFunction->"TemperatureMap"]
goes also from blue to read.
I want the colors to be correlated to the number to be plotted, not the position in the list (as above). Therefore I would like (A) to go from white to yellow (approx.) and (B) from yellow to red (approx.).
How can I make the color to be correlated with the value of the number to be plotted and not the position in the list?
Answer
Your problem is due to the fact, that the default setting is ColorFunctionScaling -> True
. You'll have to set ColorFunctionScaling -> False
with the downside, that you'll now have to take care of a proper scaling:
ListLinePlot[{0, 1, 2, 3}, ColorFunction -> (ColorData["TemperatureMap", #2/7] &),
ColorFunctionScaling -> False]
ListLinePlot[{4, 5, 6, 7}, ColorFunction -> (ColorData["TemperatureMap", #2/7] &),
ColorFunctionScaling -> False]
Comments
Post a Comment