Text Positioning - normalized versus inches
4 ビュー (過去 30 日間)
古いコメントを表示
I have a figure comprising multiple plots with a number of additional text objects. The individual plots are positioned in normalized coordinates and most of the additional text is positioned in a page-size axis system using inches. One set of text objects needs to be positioned in the vertical, one text line per row of plots (plots are n by m grid). I can't seem to get the positioning in inches to match the positioning in normalized units; the scale factor is "off". The attached simple test case illustrates my inability to align the two coordinate systems. In the example I define page size and paper size to be 5x5 inches and the axis to be [0 0 5 5]. I would expect the text boxes to overlay, but the scale factor is off only in the y axis.
hfig=figure;
hfig.Units='inches';
paperwidth=5; paperheight=5;
plotwidth= 5; plotheight=5;
hfig.OuterPosition=[0 0 paperwidth paperheight];
hfig.PaperPosition=[0 0 plotwidth plotheight];
axt=axes;
axt.Units='inches';
axt.Position=[0 0 5 5];
axt.Visible='off';
% Text positioned in inches
for i=1:4
tt=text('Units','inches','Position',[i, i],'String',strcat('i',num2str(i)),'FontSize',12);
end
% Text positioned using normalized values
axt.Units='normalized';
for n=1:4
tt=text('Units','normalized','Position',[n/5, n/5],'String',strcat('n',num2str(n)),'FontSize',12);
end
The following figure results from execution of the attached code
</matlabcentral/answers/uploaded_files/68614/TextTest%20Output.jpg> I believe the default paper orientation is "portrait", but I've tried many combinations of paper orientations, etc. The normalized scale factor obviously takes into account some additional real estate that is required at the top of the page. The figure header perhaps?
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!