can i make text extents smaller? or more uniform?
Show older comments
most of the extents of text objects on my system do not have uniform margins surrounding the text glyph. why is the extents/background so big? is there a way to make it smaller?
the margin property does not take negative values.
mostly, i want to have the extent be as close to the text as possible so i can use backgroundcolor=white to make the text annotation "pop" off the axes minor grid lines, but without interfering with other things nearby.
i suppose i could create an independent rectangle and place that. is there another way? note how the red background color is much taller than the glyph and that the left hand margin is much smaller than the right hand one

4 Comments
Jan
on 13 Dec 2011
Could you post a more readable image? Red font on red background is funny, but not useful.
How do you create the text object? Could you post an example to demonstrate the problem? "Make the text annotation "pop" off the axes minor grid lines while ensuring it's behind any of the plotted data" is not enough to let me imagine, what you are trying to achieve.
Eric
on 13 Dec 2011
Jan
on 13 Dec 2011
And now you want the read area to be tight around the text? How tight?
Eric
on 14 Dec 2011
Answers (3)
Daniel Shub
on 13 Dec 2011
0 votes
Based on your language I am going to go with NO. You can hammer on MATLAB and get reasonable looking figures and interfaces, but it lacks the fine level of control required to produce really polished things. Unless you have tight control over the hardware or printing, hand fiddling things is a waste of time because MATLAB often changes things across machines, OSs, and versions.
Daniel Shub
on 14 Dec 2011
0 votes
What about building the text and background in another program and then importing it into the figure as a image? If you need dynamic labels you could write a function that takes the desired texts and creates a postscript file with the desired text and bounding box.
Jan
on 14 Dec 2011
0 votes
For removing border see: http://www.mathworks.com/matlabcentral/answers/23937-how-to-delete-whitescale-from-photo-by-removing-column-and-rows
So you do not need another program, but you can create the text in Matlab and crop the border directly. An equivalent procedure is done in FEX: uibutton.
Does your example picture use a small 'Margin' property already? It must be greater than 0, e.g. 0.0001.
[Edited]: If you do not define the Margin property explicitely, it is set to the default 2! 0.01 is tighter.
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!