configuration of subplots - editing titles, fonts and so on

조회 수: 4 (최근 30일)
UgiLishes
UgiLishes 2019년 12월 21일
댓글: UgiLishes 2019년 12월 21일
Hey everyone,
I currently have to create a lot of subplots, and for each I want to set:
colormap gray; axis image; title('title of spesific subplot','fontname','times','fontsize',16);
Is there any way for me to configure this line only once for all of my subplots instead of adding it for each line I write?
maybe entering the 'title of specific subplot' itself as an array?
thanks,

답변 (1개)

dpb
dpb 2019년 12월 21일
That would be the obvious solution, yes. If the specific title is more or less random text, that's about the only way other than to have saved in an external text file that you read. If it's a generic title that only changes owing to some parameter, then it could be generated programmatically.
From the above limited description, structure the code as a loop over the number of subplots desired something like
nr=3; nc=2; % number rows, columns in subplot figure
nt=nr*nc; % total number subplots
for i=1:nt % for each subplot in order
hAx(i)=subplot(nr,nc,i); % create each subplot; save the axes handles
% do whatever for each subplot here
...
end

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by