configuration of subplots - editing titles, fonts and so on
2 次查看(过去 30 天)
显示 更早的评论
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,
0 个评论
回答(1 个)
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 Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!