I'd like to get a colour scheme gradient (e.g. ColorData["TemperatureMap"]
), split the domain into n equidistant points, and then recover the colour codes (RGB or Hex) for the resulting n points.
$\begingroup$
$\endgroup$
2
1 Answer
$\begingroup$
$\endgroup$
1
Clear[g]
g[color_, n_] :=
Table[ColorData[color][i], {i, 0, ColorData[color][[3, 2]], 1/n}]
List @@@ g["TemperatureMap", 10]
(*{{0.178927, 0.305394, 0.933501}, {0.33766, 0.466886,
0.942736}, {0.528934, 0.628452, 0.956059}, {0.748934, 0.803792,
0.97561}, {0.912556, 0.933111, 0.991522}, {0.984192, 0.987731,
0.911643}, {0.994726, 0.991128, 0.667358}, {0.977887, 0.93707,
0.368596}, {0.924921, 0.740045, 0.258448}, {0.867569, 0.491545,
0.211209}, {0.817319, 0.134127, 0.164218}}*)
-
$\begingroup$ Browsing this site, it seems the goal is always to avoid using
Table
. In that spirit, this does the same thing:List @@@ ColorData["TemperatureMap"] /@ Subdivide[1, 10]
$\endgroup$– Jason B.Mar 17, 2016 at 15:03
Blend
. $\endgroup$ColorData
, especially the properties. $\endgroup$