# The value of Xticklabel in MATLAB is subscript

Source: Internet
Author: User

`%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)

The value of Xticklabel in MATLAB is subscript

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.