Effacer les filtres
Effacer les filtres

Change look of margin plot

12 vues (au cours des 30 derniers jours)
Tobias Dehn Nielsen
Tobias Dehn Nielsen le 21 Nov 2022
I am using the margin function in matlab to plot the frequency response of a transfer funtion.
I have changed i names on the axes and i have tried to change the font size of the numbers on the axis.
I works with some of the numbers but not all. Is there a solution to this problem.
I want all numbers on the axes to be of size 14.
hFig = figure;
margin(G_p);
ax = gca;
ax.FontSize = 14;
fontname(gcf,"Times")
title("","FontSize",35,"FontName","Times")
labels = findall(hFig,'Type','Text');
set(labels(2),'String','Frequency [rad/s]',"FontSize",24,"FontName","Times");
set(labels(6),'String','Phase [deg]',"FontSize",24,"FontName","Times");
set(labels(9),'String','Magnitude [dB]',"FontSize",24,"FontName","Times");
xlim([10^-1 10^4])
fontname(gcf,"Times")
grid

Réponse acceptée

Jiri Hajek
Jiri Hajek le 21 Nov 2022
Hi, this special plot apparently has a specific structure. I'd suggest to try and analyze the properties of your plot object. It seems probable that the gca object will have in its structure two children axes objects and you need to set their FontSize properties. I suggest to try to search for all objects in your figure that have a FontSize property.
Hmatch = findobj(hFig,'-property',FontSize)
And then set the property for all found objects.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by