Why axis labels disappear when trying to assign their position?
古いコメントを表示
In Matlab 2012b I need to move axis labels of my plot arbitrarily. I want this because they are not placed according to my taste by default. I tried the following workaround but I'm wondered why the label disappears no matter what the offset value is.
The modified complete code is:
clc;
clear all;
close all
x=0:0.01:10;
y=10*cos(x)+5*sin(10*x).^2;
fs=[4.5,1.5]; % figure size
%--------------------------------------------------------------------------
fh=figure;
set(fh,'Color','w')
set(fh,'Units','inches','Position',[3 3 fs])
set(fh,'PaperUnits','normalized','PaperSize',[1 1],'PaperPosition',[0 0 1 1])
ah=axes;plot(x,y,'Color',[1 0 0],'LineWidth',1)
hold on;
grid on;
box on
set(ah,'LineWidth',1)
set(ah,'FontName','Calibri','FontSize',10,'FontWeight','bold')
set(ah,'OuterPosition',[0 0 1.0 1.0])
xlh=xlabel('\itTime (s)','Units','normalized');
pos1=get(xlh,'Position');
pos1(1,2)=pos1(1,2)-0.05;
set(xlh,'Position',pos1)
ylh=ylabel('\ity_1');
What exactly want is to get xlabel a little bit closer to the axis. Something that I feel happening is that the label with it's position assigned manually will not be included in axis outer position region anymore. Am I right?
2 件のコメント
Jan
2014 年 1 月 18 日
Please provide some example data, such that we can reproduce your problem.
Pouya Jamali
2014 年 1 月 18 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Axis Labels についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!