manually setting plot properties

조회 수: 9 (최근 30일)
Sara
Sara 2011년 6월 15일
I'm really struggling with an apparently simple piece of code for plotting a graph. The actual graphs are made up of 5 subplots but I've only reproduced 2 below. I'm trying to get the graph in A4 portrait style (for full-page printing) and with every axis following a fixed size (eg 100 x 500px). I don't really know how to use axes_handles -- I've tried using 'set' to specify axis properties and it didn't work. I don't really know how to rewrite the following code in order to gain control of my plots. I need to do this by code rather than using plotting tools as I need to do this for thousands of graphs. Thanks,
ax(1) = subplot(2,1,1);
plot(date1, Data(:,2),'-b',...
date1, Data(:,3),':k');
legend('Average','Total', 'Location', 'SouthOutside', 'Orientation', 'horizontal');
title('24hr Data');
ylabel('Energy (Wm^2)');
datetick('x', 16);
xlim([min(date1) max(date1)]);
ax(2) = subplot(2,1,2);
plot(date1, rsum, ':m',...
date1,Data(:,4),'-b');
legend('Average','Open', 'Location', 'SouthOutside', 'Orientation', 'horizontal');
title('24h');
ylabel('Vol (2)');
datetick('x', 16);
xlim([min(date1) max(date2)]);
linkaxes(ax,'x');

답변 (2개)

azarm
azarm 2011년 6월 15일
Hi, if you want to set a fix size for x-y coordinates , just use the function "axis" in matlab!
- doc axis

Patrick Kalita
Patrick Kalita 2011년 6월 15일
I'm not sure I entirely understand the question, but maybe this will be a starting point for you.
First, the command orient can help you set up the figure so that when printed, it will print in portrait mode and use the full page. Second, setting the figure's PaperType property will tell the figure what size of paper to expect. To summarize, these are the two commands you would use:
orient tall
set(gcf, 'PaperType', 'A4')
You won't see any visible difference on screen, but when the figure is actually printed to paper, it should occupy the entire A4 page.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by