Author: Nkxz @ http://emuch.net/
URL: http://emuch.net/html/201210/5088133.html
您好,在您每次画图完以后,加入如下代码即可。
y_formatstring = '%3.4f'; % Here's the code. ytick = get(gca, 'ytick'); for i = 1:length(ytick) yticklabel{i} = sprintf(y_formatstring, ytick(i)); end set(gca, 'yticklabel', yticklabel)
function rotateTickLabel(h, xRange, yRange , rot) %This function is to convert double array to wanted format. % @Author Shuxiao Cai % @Date Sep 19, 2015 a=get(h,'XTickLabel'); set(h,'XTickLabel',[]); xTickLabelPosition=get(h,'XTick'); %make new tick labels text(xTickLabelPosition+0.02*(xRange(2)-xRange(1)), ... repmat(yRange(1)+0.05*(yRange(2)-yRange(1)), length(xTickLabelPosition), 1), ... a, ... 'HorizontalAlignment','right', ... 'fontsize',10,'fontweight','normal', ... 'rotation',rot ... ); end