I'm trying to do some bar charts and pie charts in Mathematica, but I can't figure out how to make the legend colors correspond to the actual colors on the charts. I'm running
10.4.0 for Linux x86 (64-bit) (February 26, 2016)
The code that I've got is:
PieChart[
{1, 2, 3, 4},
ColorFunction -> Function[{angle}, ColorData["DarkRainbow"][angle]],
ChartLegends -> {"This", "is", "the wrong", "color"}
]
What I get is the following:
This persists for BarChart
as well, I haven't tried any others, but I'm guessing it has something to do with the legending options in general.
Any idea how to make the ChartLegends
behave according to the ColorFunction
? I've been trying to go through the documentation, but it's not exactly as detailed as I'd like it to be.
Function[{angle}, ColorData["DarkRainbow"][angle]]
is in most cases the same asColorData["DarkRainbow"]
. $\endgroup$