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 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by