%axis for'x'Or'y', which means changing the x or y scale, respectively%ticks is the character cellfunction Settick (axis,ticks) n=length (ticks); Tkx=Get(GCA,'XTick'); tky=Get(GCA,'Ytick');SwitchAxis Case 'x'W=linspace (Tkx (1), Tkx (end), n); Set(GCA,'XTick'W'Xticklabel', []);%Refresh the scale to remove the tick value YH=( -*w (1)-W (end))/ -;%Adjust scale ordinate position by axis scale forI=1: N Text ('Interpreter','Tex','String', ticks (i),'Position', [w (i), YH],'HorizontalAlignment','Center'); End Case 'y'W=linspace (Tky (1), Tky (end), n); Set(GCA,'Ytick'W'Yticklabel', []); XH=( One*w (1)-W (end))/Ten; forI=1: N Text ('Interpreter','Tex','String', ticks (i),'Position', [Xh,w (i)],'HorizontalAlignment','Center'); EndEnd
For example:
>> X=0:0.1:4*pi;plot (X,sin (x)) ticks={' g_1 ' g_2 ' g_3 ' g_4 ' g_5 (' x ',};settick ')
>> Figure;x=0:0.1:4*pi;plot (X,sin (x)) ticks={' g_1 ' g_2 ' g_3 ' g_4 ' g_5 (' y ',};settick)
From:http://www.ilovematlab.cn/thread-39718-1-1.html
The value of Xticklabel in MATLAB is subscript