How to change thickness and font of all axes in a subplot?
34 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2016-8-10
回答: MathWorks Support Team
2016-8-10
I'm plotting a step response of a single input , multi output system using step command. The result is a n*1 subplot. How do I change the font or line thickness of all the subplots together. When I use the following command:
set(gca,'FontName','Arial','FontSize',12,'FontWeight','Bold', 'LineWidth', 2);
it only change the last subplot.
采纳的回答
MathWorks Support Team
2016-8-10
The reason for the behavior that only the last axes is modified is because in your command, you are using 'gca' to set the properties. Using 'gca' gets hold of only the current axes, which in this case would be the last axes that was plotted on the figure.
In order to workaround the issue, you would need to get all the axes handles in the figure. To achieve this, you may use'findobj' function as findobj(gcf,'type','axes'). Please refer to the following code snippet:
subplot(211); plot(1:10);
subplot(212); plot(randi(10,1,10));
set(findobj(gcf,'type','axes'),'FontName','Arial','FontSize',12,'FontWeight','Bold', 'LineWidth', 2);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!