The ability to move and rescale a pie chart is not available in MATLAB.
To work around the issue, move and rescale the patch graphics and text labels individually.
PIE does not produce a single handle for the entire plot; instead, it produces a collection of PATCH graphics to represent the slices, and a series of text labels. The most direct way to move the pie is to directly modify the position and size of the individual slices and labels. This segment of code walks through the resulting list, scaling and moving pie slices (represented as patch graphics) and text:
contour(membrane(1));
axis square;
hold on;
X = [1 3 5];
h = pie(X);
xpos = 10;
ypos = 22;
scale = 5;
for k = 1:length(h)
if strcmp(get(h(k),'Type'),'patch')
XData = get(h(k),'XData');
YData = get(h(k),'YData');
set(h(k),'XData',XData*scale + xpos);
set(h(k),'YData',YData*scale + ypos);
else
Pos = get(h(k),'Position');
set(h(k),'Position',Pos*scale + [xpos ypos 0]);
set(h(k),'FontSize',8);
end
end
Best Answer