Pie chart with arrows without text coincidence on each other

5 views (last 30 days)
I would like to show the text with arrows to the piechart. Because text is concided on each other and it is not clear.appreciate your support.
figure ()
X = [0.287 0.03 0.123 0.046 0.026 0.007 0.004 0.01 0.011 0.038 0.03 0.025 0.013 0.025 0.011 0.098 0.054 0.062 0.023 0.008 0.033 0.029 0.007];
labels={'Hygiene (28.7%)','Medical/surgical (3.0%)','Wipres for personal care (12.3%) ','Wipes-other (4.6%)','Cotton pads (2.6%)','Garments (0.7%)','Interlinings (0.4%)','Leather goods (1.0%)','Coating substrates (1.1%)','Floor coverings (3.8%)', 'Upholstery/Household (3.0%)','Wall coverings (2.5%)','Table Linen (1.3%)','Air/gas filtration (2.5%)','Liquid filtration (1.3%)','Building/roofing (9.8%)','Civil engineering/underground (5.4%)','Automotive (6.2%)','Agriculture (2.3%)','Electronic materials (0.8%)','Food and beverage (3.3%)','Others (2.9%)','Unidentified (0.7%)'};
p=pie(X,labels)
t1=p (2)
t1.FontSize = 16;
t2=p (4)
t2.FontSize = 16;
t3=p (6)
t3.FontSize = 16;
t4=p (8)
t4.FontSize = 16;
t5=p (10)
t5.FontSize = 16;
t6=p (12)
t6.FontSize = 16;
t7=p (14)
t7.FontSize = 16;
t8=p (16)
t8.FontSize = 16;
t9=p (18)
t9.FontSize = 16;
t10=p (20)
t10.FontSize = 16;
t11=p (22)
t11.FontSize = 16;
t12=p (24)
t12.FontSize = 16;
t13=p (26)
t13.FontSize = 16;
t14=p (28)
t14.FontSize = 16;
t15=p (30)
t15.FontSize = 16;
t16=p (32)
t16.FontSize = 16;
t17=p (34)
t17.FontSize = 16;
t18=p (36)
t18.FontSize = 16;
t19=p (38)
t19.FontSize = 16;
t20=p (40)
t20.FontSize = 16;
t21=p (42)
t21.FontSize = 16;
t22=p (44)
t22.FontSize = 16;
t23=p (46)
t23.FontSize = 16;
  1 Comment
the cyclist
the cyclist on 18 Mar 2023
Not a solution to your question, but a much more compact way to change all your font sizes is
figure
X = [0.287 0.03 0.123 0.046 0.026 0.007 0.004 0.01 0.011 0.038 0.03 0.025 0.013 0.025 0.011 0.098 0.054 0.062 0.023 0.008 0.033 0.029 0.007];
labels={'Hygiene (28.7%)','Medical/surgical (3.0%)','Wipres for personal care (12.3%) ','Wipes-other (4.6%)','Cotton pads (2.6%)','Garments (0.7%)','Interlinings (0.4%)','Leather goods (1.0%)','Coating substrates (1.1%)','Floor coverings (3.8%)', 'Upholstery/Household (3.0%)','Wall coverings (2.5%)','Table Linen (1.3%)','Air/gas filtration (2.5%)','Liquid filtration (1.3%)','Building/roofing (9.8%)','Civil engineering/underground (5.4%)','Automotive (6.2%)','Agriculture (2.3%)','Electronic materials (0.8%)','Food and beverage (3.3%)','Others (2.9%)','Unidentified (0.7%)'};
p=pie(X,labels);
% Find the text objects in your pie chart
textObjects = findobj(p,"type","text");
% Change their font size
set(textObjects,"FontSize",16)

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 18 Mar 2023
This is a case where you need to ask yourself, "What is the information I really need to convey to my audience, and what is the best way to convey it?" I think you will find that the answer is not going to be a pie chart with 23 slices.
If your audience really and truly needs to know the value of every sector, then a table with the values sorted is almost certainly the better way.
If they don't really need to know all those tiny percentages, then lump most of the tiny ones into a single "Other" category, and just do your pie chart (or better yet a bar chart) with the larger categories.
Even if you succeed is moving all the labels around so that they do not overlap, this is simply not an effective presentation of information.
  2 Comments
Hege
Hege on 23 Mar 2023
Thank you very much for the simplification. Yes.Agreed.Showing very minor does not make any sense to the audience.I am changing it . Thank you very much. However, Could you pls kindly tell me how I should increase the font size of the legends attached in this image. I tried using last few lines of below code. But it did not work. Appreciate your support.Thanks again.
figure
X = [63 22.5 8 2 1.5 3];
labels={'Polypropylene','Polyester','Viscose rayon ','Acrylic','Polyamide','Other speciality fibres'};
p=pie(X);
% Find the text objects in your pie chart
textObjects = findobj(p,"type","text");
% Change their font size
set(textObjects,"FontSize",16)
lgd = legend(labels);
lgd.Layout.Tile = 'east';
ax = gca;
ax.FontSize = 16;

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!