Printing Axes
조회 수: 19 (최근 30일)
이전 댓글 표시
Hi everybody
I have 8 axes in my gui . How can i print three of them ? 'print' function is print all figure window. I don't want to print all of figure.
Thanks for help...
댓글 수: 0
채택된 답변
Oliver Woodford
2011년 7월 21일
With export_fig you can specify a list of handles of the axes to print, and only these axes will be printed. E.g.:
figure;
for a = 1:4
hax(a) = subplot(2,2,a);
plot(rand(3));
end
export_fig(hax([1 3]), 'test.png');
It essentially implements Daniel's suggestion, so you don't have to. However, it may not work perfectly with GUIs as they tend to behave differently. Try it, though.
댓글 수: 1
추가 답변 (1개)
Daniel Shub
2011년 7월 21일
Printing each subplot/axes as a separate figure is easier than printing a subset of the axes in one figure. Start with a dummy figure making sure you remember the handle to the axis you want to print:
figure;
subplot(2,2,1);
plot(1:10);
hax = subplot(2,2,2);
plot(1:5);
Make a new figure, copy the axis to it, scale the axis to be the "full" size, and print it.
hfig = figure;
hax_new = copyobj(hax, hfig);
set(hax_new, 'Position', get(0, 'DefaultAxesPosition'));
print(hfig);
You can copy multiple axes in on go, but positioning them nicely in the figure is more difficult.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!