Change look of margin plot

조회 수: 29 (최근 30일)
Tobias Dehn Nielsen
Tobias Dehn Nielsen 2022년 11월 21일
답변: Jiri Hajek 2022년 11월 21일
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

채택된 답변

Jiri Hajek
Jiri Hajek 2022년 11월 21일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Plot Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by