# Distribute labeling function over a list in order to assign different labels in a PieChart

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"]}}

• Try PieChart[MapThread[Labeled, {{{1, 2, 3}, {4, 5, 6}}, {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}}, 2]]. Commented Aug 19, 2017 at 17:01
• Aha MapThread is the function I need, god I love mathematica, thanks a bunch ;)! Commented Aug 19, 2017 at 17:04
• @J.M: Quick follow-up question: What if I want to supply options to Labeled like Background->Red or LabelStyle->Red or something? I tried PieChart[MapThread[ Labeled[#1, #2, LabelStyle -> Red] &, {{{1, 2, 3}, {4, 5, 6}}, {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}}, 2]] but get an error message Commented Aug 19, 2017 at 18:24
• LabelStyle won't work in that case, yes. Try PieChart[MapThread[ Labeled[#1, Style[#2, Red]] &, {{{1, 2, 3}, {4, 5, 6}}, {{"l1", "l2", "l3"}, {"l4", "l5", "l6"}}}, 2]]. Commented Aug 19, 2017 at 18:28
• I see, thank you again!! Commented Aug 19, 2017 at 20:52

data = {{1, 2, 3}, {4, 5, 6}};