If one increases the number of colored items in a BarChart
or PieChart
one can see that its color scheme is based on a gradient of some sort:
charts[n_] := Module[
{data = ConstantArray[1, n]
, opts = Sequence[
ImageSize -> Tiny
, ChartBaseStyle -> EdgeForm[None]
, PerformanceGoal -> "Speed"
, ImagePadding -> 0
, Axes -> False
]
}, {BarChart[{data}, opts], PieChart[data, opts]}
]
Column[charts /@ {2, 5, 100}]
Basically, the two colors seen for the case n = 2 are the ends of the gamut. Assigning colors to n > 2 items amounts to picking n - 2 additional colors evenly spaced between these two ends.
I stared for a while at the available gradients looking for one that matched , but I can't spot it.
Does anyone know the default color function for these chart types?
n = 100; Lighter[#1, 0.66] & /@ Table[Hue[0.6 (1 - i)], {i, 0, 1, 1/(n - 1)}]
- ref. Link, but I don't know the formula for the new colours. $\endgroup$ColorData[111]
resembles those colors, however they are not indexed sequentially to produce a gradient in an obvious way. $\endgroup$