📄 xtickrot.m
字号:
function h=xtickrot(angle)% XTICKROT Rotate X tickmarks labels%%%%% current limitsax = axis ;% current axis y directionydir = get(gca,'YDir') ;% set limit modes to manualaxis(axis); % retrieve current labels and ticksxt = get(gca,'XTick') ;xl = get(gca,'XTickLabel') ;% there might be more ticks than labels, or just% one label, repeated for all axesif ischar(xl) l = xl ; xl = cell(1,length(xt)) ; for i = 1:length(xt) xl{i} = l ; endelse xt = xt(1:length(xl)) ;end% add text objectsswitch ydir case 'reverse' h = text(xt, ax(4)*ones(1,length(xt)), xl) ; case 'normal' h = text(xt, ax(3)*ones(1,length(xt)), xl) ;end% rotate themif angle > 0 ha = 'right' ;else ha = 'left' ;endset(h,'HorizontalAlignment',ha,... 'VerticalAlignment','top', ... 'Rotation',angle);% remove current labelsset(gca,'XTickLabel','')% now deal with the x-labelxll = get(gca,'XLabel') ;if(~isempty(xll)) for i = 1:length(h) its_units = get(h(i),'Units') ; set(h(i),'Units', 'normalized') ; ext(i,:) = get(h(i),'Extent') ; set(h(i),'Units', its_units) ; end set(xll, 'Units','normalized') ; pos = get(xll,'Position') ; x0 = pos(1) ; y0 = min(ext(:,2)) ; set(xll,'Position',[x0 y0],... 'VerticalAlignment', 'top',... 'HorizontalAlignment', 'center') ;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -