新浪博客

[转载]【原创】更改Matlab 坐标轴标注成科学计数法 +&

2019-02-28 17:35阅读:

%% ***********************[Random Test]***********************
%*******************[Change Matlab axis label to Exponential + move the exponet above the axis]*********************************
plot([0 1],[0 .02])
oldLabels = str2num(get(gca,'YTickLabel'));
scale = 10^2;newLabels = num2str(oldLabels*scale);
set(gca,'YTickLabel',newLabels,'units','normalized');
posAxes = get(gca,'position');
textBox = annotation('textbox','linestyle','none','string',['x 10it^{' sprintf('%0.2f',log10(1./scale)) '}']);
posAn = get(textBox,'position');
set(textBox,'position',[posAxes(1) posAxes(2)+posAxes(4) posAn(3) posAn(4)],'VerticalAlignment','cap');
%% ***********************[Random Test]***********************


Src link: http://www.math
works.co.uk/matlabcentral/newsreader/view_thread/112386

我的更多文章

下载客户端阅读体验更佳

APP专享