2
$\begingroup$

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}}]; value=0.8; Graphics[{ColorFunction -> "TemperatureMap"[value], tr}] 
$\endgroup$
3
  • $\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$ Commented Jan 29, 2018 at 20:14
  • 3
    $\begingroup$ Graphics[{ColorData["TemperatureMap"][0.8], tr}] $\endgroup$ Commented Jan 29, 2018 at 20:17
  • $\begingroup$ Thanks. It wasn't clear enough from the documentation, that it's possible. $\endgroup$ Commented Jan 29, 2018 at 20:21

1 Answer 1

3
$\begingroup$

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

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.