How to change thickness and font of all axes in a subplot?
36 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 10 Août 2016
Réponse apportée : MathWorks Support Team
le 10 Août 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.
Réponse acceptée
MathWorks Support Team
le 10 Août 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!