How to enlarge pie chart to appear more clearly?

I have a three subplot of large data, however due to the large volume of data currently 90 entries the pie chart does not appear clearly what code can I use to enlarge it and show it more clearly y = dataset (:,4) h = pie(y);

2 Comments

can you expand on what you mean does not appear clearly? the pie sections? the text? a representative image sample with notation of what you'd like to change. One major question would be why do you need it as a subplot as it'll be forced to share the figure window with the other plots.
Hi Joseph I hope this image would help. The pie section does not appear clearly the text. Any help to make the image more clear is highly appreciated. As for why do you need the three subplot to make it easier to explain the relation within the same image no need to set up to windows and open multiple images I am just not happy with the pie section

Sign in to comment.

Answers (2)

Here is a quick intro example of what you can do by modifying the handles of the plots. not sure what you're going for but hopefully it's covered somewhere in here and points you to what else you can do to accomplish what you're looking for.
%%sample:
figure(1)
%3 pie charts to maximize area they can be placed would be in a triangle
%position first subplot top middle
sh(1)=subplot(2,1,1);
%generate some dummy data with 90 entries
x=randi(100,1,90);
pieH1=pie(x);
%since there are so many entries it may be hard to visualize especially
%with the text possibly overlapping
%adjust slice and text position (here we've offset every other entry)
%examine the pieH1 data and you'll see that pie slice data is odd indexes
%text is even entries.
for ind = 2:4:numel(pieH1)
pieH1(ind).Position = pieH1(ind).Position*1.1;
pieH1(ind-1).Vertices = pieH1(ind-1).Vertices*1.1;
end
%position second subplot bottom left
sh(2)=subplot(2,2,3);
%generate some dummy data with 90 entries
x=randi(100,1,90);
pieH2=pie(x);
%since there are so many entries it may be hard to visualize especially
%with the text possibly overlapping
%adjust slice and text position (here we've offset every other entry)
for ind = 2:4:numel(pieH2)
pieH2(ind).Position = pieH2(ind).Position*1.1;
pieH2(ind-1).Vertices = pieH2(ind-1).Vertices*1.1;
end
%position second subplot bottom left
sh(3)=subplot(2,2,4);
%generate some dummy data with 90 entries
x=randi(100,1,90);
pieH3=pie(x);
%since there are so many entries it may be hard to visualize especially
%with the text possibly overlapping
%adjust slice and text position (here we've offset every other entry)
for ind = 2:4:numel(pieH3)
pieH3(ind).Position = pieH3(ind).Position*1.1;
pieH3(ind).FontSize= 7; %example of making font smaller
pieH3(ind-1).Vertices = pieH3(ind-1).Vertices*1.1;
end
%
%adjust positioning of subplots
%here is just an example of adjusting the subplot position.
sh(1).Units ='normalized'; %to be normal to figure window
sh(1).Position = [sh(1).Position(1)*0 sh(1).Position(2)*.8 sh(1).Position(3:4)*1.3];

2 Comments

The above code was really helpful, definitely will be useful in the near future, however in this particular case I am just looking to make the pie chart bigger for people to see.
well my above code does show how to accomplish this. but the problem is even if you increase the size of the pie the allocated region for the pie chart is still extremely small especially with the number of slices.
in my example that last section shows how to adjust the size of the pie chart by adjusting the allocated area of the subplot.
looking at your data i would suggest going away from a pie chart and plotting like you did with the others but the y axis would be percentages and x be your bin.

Sign in to comment.

Try this:
embiggenby = 20; % <-enter a value here; it's a percent.
% Make a plot:
subplot(3,1,2)
pie(rand(10,1))
% Get position of the plot:
pos = get(gca,'outerposition');
% Change axis position:
pos(2) = pos(2) - embiggenby/2;
pos(3) = pos(3)+ embiggenby
% Set new axis position:
set(gca,'outerposition',pos)

3 Comments

However, pie charts are quite ineffective at displaying data, and should almost always be avoided. Pie charts make it difficult for the viewer to directly compare one slice of the pie to another. The goal of a chart is to enhance understanding by putting data into context, yet pie charts strip data of their context by requiring viewers to pull out a protractor to get a sense for which slices are larger or smaller.
Could not make the code work

Sign in to comment.

Asked:

on 28 May 2016

Commented:

on 31 May 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!