Group Abstract Group Abstract

Message Boards Message Boards

Plot multiple pie charts with individual titles and labels?

Posted 8 years ago
POSTED BY: Jorge Mahecha
6 Replies

I was wondering how to set things up with MapThread. Thank you, Sander!

POSTED BY: Jorge Mahecha

For different options for each PieChart you can either go the Table-route or the MapThread-route:

data = {{3, 5, 1}, {2, 18, 10}, {1, 4, 9}};
plotlabels = {"plot a", "plot b", "plot c"};
MapThread[PieChart[#1, PlotLabel -> #2] &, {data, plotlabels}]

enter image description here

You can add as many variables you like (say different colors, or annotations or ....) and use #3, #4 et cetera...

POSTED BY: Sander Huisman

This is really useful. Thanks again, David. This should be useful to a lot of people.

POSTED BY: Jorge Mahecha
POSTED BY: David Annetts

Thank you, David.

This is incredibly useful. What I'm trying to do is producing reports for individual questions in a survey. Each question has a title (the actual question text). Every question in the survey has the same response categories (Strongly disagree, disagree, agree, strongly agree).

I need an easy way to customize all pie charts (i.e include titles, labels, color schemes, etc) at once or as close to "at once" as possible. In SPSS for example, it's easy to make several graphs at once. Customization has to be done individually, as far as I know.

POSTED BY: Jorge Mahecha

What do you want to do with the charts?

With data as

data = RandomInteger[{0, 25}, {5, 3}];

one approach might be

plot = PieChart[data[[#]], PlotLabel -> #, 
    ChartLegends -> {"a", "b", "c"}, 
    ChartLabels -> {"a", "b", "c"}] & /@ Range[Length@data]

which we can export using

Export[StringJoin["Chart_", IntegerString[#], ".pdf"], plot[[#]]] & /@ 
 Range[Length@data]
POSTED BY: David Annetts
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard