4.6 | 5 ratings Rate this file 18 Downloads (last 30 days) File Size: 24 KB File ID: #41475
image thumbnail

bordertext( varargin )



23 Apr 2013 (Updated )

Place text on borders of the figure, border of the subplots, on the inner-side or outer-side.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

Place text on borders of the figure, border of the subplots, on the inner-side or outer-side. Also control the most important text-properties with one simple FormatString.
Text stays on the borders, even while zooming, panning, etc.
Try 'bordertext' without arguments to see the demo (figure is added as screenshot)

Required Products MATLAB
MATLAB release MATLAB 8.4 (R2014b)
MATLAB Search Path
Other requirements Tested on WinXP 32&64 bit, Win7 32&64 bit
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
25 Aug 2014 zilong

zilong (view profile)

Thanks for your good work.

20 Feb 2014 arnold

arnold (view profile)

Hey Jan,
any Chance you can add that padding function? I've looked around the code, it's very well written, but I can't seem to find a way to implement it.

Comment only
06 Feb 2014 Jeremy

Jeremy (view profile)

18 Nov 2013 RC

RC (view profile)

This is super; thanks Jan for bringing to us

Comment only
18 Nov 2013 Henry Wolkowicz  
16 Sep 2013 arnold

arnold (view profile)

here is what I mean by 'padding'. This is what it looks like right now:

This is what I mean by 'padding':

I think this would really help with readability. If one could set a margin of several pixels so the text wasn't touching the axis.


Comment only
16 Sep 2013 arnold

arnold (view profile)

thanks Jan. Having the standard matlab syntax available is awesome.

Have you thought about a 'padding'?
The Text Property 'margin' doesn't work since it expands around the text, so maybe you can correct the position by the margin size.


Comment only
12 Sep 2013 Jan de Wilde

Thank you Arnold for your comment (and rating). I've solved the background overlap and I added the matlab syntax.
Your other suggestion to add transparency to the text background is impossible, because the text object has no BackgroundAlpha property.

Comment only
05 Sep 2013 arnold

arnold (view profile)

Another idea:
If you added a "padding" to your positions, this could solve the problem of the background/text overlapping with the axis borderlines. I think it would also look nicer in some cases

Comment only
05 Sep 2013 arnold

arnold (view profile)

great tool!!!
It would be even better if you could add transparency/alpha to the background-color and bordercolor so one can still see data behind the box.

It would also be a little more intuitive if it used the standard syntax for all the coloring and stuff, i.e.
'BackgroundColor', 'red'

... I guess it'll be hard to memorize the syntax otherwise.

Something else:
When placing Text with a background at 'innertopright' for example, it extends over the axis box line. Would be great if that didn't happen for all Positions.

23 Apr 2013 chang hsiung

thanks, this will be quite handy.

11 Sep 2013

Background of the text doesn't overlap the axis anymore.
Added the matlab syntax, as suggested bij arnold

28 May 2014

Some speed optimizations.
Option added: zoom text when using as Position an [X Y]-position: 'ZoomText','on'

12 Feb 2015

Bugfix for R2014b; HandleGraphics2 (zooming,panning etc was not working anymore)

Contact us