ticklabelx.m

来自「hi i have a huge collection are you int」· M 代码 · 共 26 行

M
26
字号
function ticklabelx(labx,strx)if nargin == 1   strx='';endXt=get(gca, 'Xtick');Yt=get(gca, 'Ytick');Xl=get(gca, 'XLim');Yl=get(gca, 'Ylim');% Place the new Xtick labelstx = text(Xt,Yl(1)*ones(1,length(Xt)),labx);set(tx,'HorizontalAlignment','center','VerticalAlignment','top')      % Remove the default XTicklabelsset(gca,'XTickLabel','')%Find the extent of the XtickLabelsfor i = 1:length(tx)   extx(i,:) = get(tx(i),'Extent');end   posx=get(get(gca, 'xlabel'), 'position');xlabel(strx, 'Position', [posx(1) min(min(extx)) posx(3)])

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?