I have several primitive figures to pass to the Graphics function to draw. These figures are weighed with some values, so I'd like to assign a color in accordance with some ColorFunction, say "TemperatureMap". Is it possible to use Graphics like this?

tr = Triangle[{{0, 0}, {0.25, 0}, {0.125, 0.25}}];
Graphics[{ColorFunction -> "TemperatureMap"[value], tr}]
  • $\begingroup$ You have a list of Graphics primitives, and a list of values? You'd like for each primitive to have a single color according to its value? $\endgroup$
    – Jason B.
    Jan 29, 2018 at 20:14
  • 3
    $\begingroup$ Graphics[{ColorData["TemperatureMap"][0.8], tr}] $\endgroup$
    – Szabolcs
    Jan 29, 2018 at 20:17
  • $\begingroup$ Thanks. It wasn't clear enough from the documentation, that it's possible. $\endgroup$ Jan 29, 2018 at 20:21

1 Answer 1


Yes, you can, but you should be aware of the values that the color scheme (TemperatureMap in this case) can take:

tr = Triangle[{{0, 0}, {0.25, 0}, {0.125, 0.25}}];
Graphics@{ColorData["TemperatureMap"][#], tr} & /@ Range[0, 1, 0.1]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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