Tuesday 15 March 2011

matlab - How to center text on a line -


I have a string that focuses on a line I have tried to do this:

 < Code> data axis ([0,10,0,10]) d = 2.81; Center = 5; Line ([center - D, center + D], [5,5]) th = text (center, 4.9, 'mm mmmmmmmmmmmmmmmmmmmm'); Set (th, 'horizontal alignment', 'center')   

no text The focus is on the line

The text is aligned to the right with the line, but the image above is not a screen shot. I did not have this problem consistently in the saved versions of the figures

Is there a way to focus the text on a line? I'm not worried about shaping this figure right now, but I want to use the default font.

It seems that it is not possible to place the text arbitrarily accurate. I was tried to get the texting and the size of the drawing line and accordingly the positioning text again. More about text properties.

  str1 = 'mmmmmmmmmmmmmmmmmmmmmm'; Center = 5; Text_line_spacing = 0.2; Figure axis ([0,10,0,10])% set text initial th = text (0,0, str1); % Text size gets ext = received (th, 'extant'); % Text_width = ext (3); % Text_height = ext (4); % Appropriate row left = center - exp (3) / 2; Right = center + ext (3) / 2; Line ([left right], [5 5]) Restore% of the original text set (th, 'position', [left 5 + text_line_spot]);    

No comments:

Post a Comment