can i make text extents smaller? or more uniform?

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

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.
thanks jan. posted a less pixelized image and clarified question a bit.
And now you want the read area to be tight around the text? How tight?
as tight as possible. but frankly any ability to make the margin smaller would be useful. right now i'm placing smaller rectangles before i place the text and aligning the rectangle and text can be difficult when horizontal alignment changes, text reports inaccurate extents, etc

Sign in to comment.

Answers (3)

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.
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.

1 Comment

interesting suggestion. it'll be way too slow if i have 0..5 text labels in a single plot, 4..12 in a figure page and possibly 10..100 pages. particularly because the users are usually in AFS space, possibly over a vpn. the white background rectangle with over-layed separate text is working fine for now. i'm just fiddling with details. i'm surprised if no one else wants tighter control on the text object margin. thanks again for an interesting option that might help others.

Sign in to comment.

Jan
Jan on 14 Dec 2011
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.

2 Comments

no margin property setting in above image. thanks Jan, i'll look into uibutton and the other question/answer

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Asked:

on 13 Dec 2011

Community Treasure Hunt

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

Start Hunting!