Set the position of the Xtick labels matlab -


i want shift x ticks labels downwards in figure:fig

i'm not sure how this?

this script i'm using:

y=[0.5093 0.8526 0.9171]; x=[0 1600 1100]; hand =plot(y, 'ob-'); set(gca, 'xtick',1:3, 'xticklabel',{'no interference' '1600' '1100'}) set(hand, 'linewidth', 4); set(hand, 'markersize', 30); set(findobj('type','text'),'fontsize',25); set(gca,'fontsize',25); set(findobj('type','axes'),'fontsize',25); h=get(gca,'title'); set(h,'fontsize',20); 

following example mathworks solution, can use text function add labels in position wish.

increase value of delta larger gap between x tick labels , x axis.

edit: added custom control of yticks: value of stp changes step between each tick. more general solution identify end-points of tick range automatically well.

figure(1), clf  % set data example y=[0.5093 0.8526 0.9171]; x=[0 1600 1100]; xt=1:length(x); hand =plot(y, 'ob-'); set(gca, 'xtick',xt);  stp=0.05; yt=0.5:stp:0.95; set(gca, 'ytick', yt)  % reduce size of axis labels fit in figure. pos = get(gca,'position'); set(gca,'position',[pos(1), .2, pos(3) .7])  ax = axis; % current axis limits axis(axis); % set axis limit modes (e.g. xlimmode) manual yl = ax(3:4); % y-axis limits xl = ax(1:2);  % place text labels -- value of delta modifies how far labels  % axis. delta=0.1; t = text(xt, yl(1)*ones(1,length(x))-delta, {'no interference' '1600' '1100'}); %set(t, 'horizontalalignment','left','verticalalignment','top') set(t, 'horizontalalignment','center','verticalalignment','middle')  % remove default labels set(gca,'xticklabel','')  % , continue other settings required set(hand, 'linewidth', 4); set(hand, 'markersize', 30); set(findobj('type','text'),'fontsize',25); set(gca,'fontsize',25); set(findobj('type','axes'),'fontsize',25); h=get(gca,'title'); set(h,'fontsize',20); 

the text function has lots of options can configure.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -