I have a PieChart:
PieChart[{{1, 2, 3}, {4, 5, 6}}]
I want to label each sublist differently, but
PieChart[{{1, 2, 3}, {4, 5, 6}}, ChartLabels -> {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}]
does not work, because the first part of the Labellist will be associated with the row label. So I thought the only solution to this will be to assign a Label to each entry separately by using Labeled
But then I got stuck with distributing the Labeled
function over the values list. For example, given the list of values for the PieChart:
labList = {{1, 2, 3}, {4, 5, 6}}
I can apply Labeled
to each element in this list:
labeledStuff = Map[Labeled[#, "Label"] &, labList, {2}]
But how to apply a different label to each element? That is, given the list with labels:
labels = {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}
apply each of these labels to each element of the value list, resulting in the following:
{{Labeled[1,"l1"],Labeled[2,"l2"],Labeled[3,"l3"]},{Labeled[4,"l4"],Labeled[5,"l5"],Labeled[6,"l6"]}}
PieChart[MapThread[Labeled, {{{1, 2, 3}, {4, 5, 6}}, {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}}, 2]]
. $\endgroup$MapThread
is the function I need, god I love mathematica, thanks a bunch ;)! $\endgroup$Labeled
likeBackground->Red
orLabelStyle->Red
or something? I triedPieChart[MapThread[ Labeled[#1, #2, LabelStyle -> Red] &, {{{1, 2, 3}, {4, 5, 6}}, {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}}, 2]]
but get an error message $\endgroup$LabelStyle
won't work in that case, yes. TryPieChart[MapThread[ Labeled[#1, Style[#2, Red]] &, {{{1, 2, 3}, {4, 5, 6}}, {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}}, 2]]
. $\endgroup$