How to change thickness and font of all axes in a subplot?
34 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 10 Aug. 2016
Beantwortet: MathWorks Support Team
am 10 Aug. 2016
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.
Akzeptierte Antwort
MathWorks Support Team
am 10 Aug. 2016
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!