File Exchange

image thumbnail

label

version 1.4 (585 KB) by Chad Greene
label data directly on a plot

3.8K Downloads

Updated 02 Feb 2015

View License

An alternative to text, legend, or annotation commands, this function allows you to label objects directly on a plot by entering the handle of a plotted object and a string. Label text is automatically colored to match plotted data, or text color can be entered manually.
Syntax
label(h,'string')
label(...,'location',LocationString)
label(...,'TextProperty',PropertyValue)
label(...,'slope')
h = label(...)

Description
label(h,'string') places 'string' near the leftmost data described by handle h.

label(...,'location',LocationString) specifies location of the string. LocationString can be any of the following:

'left' or 'west' (default)
'right' or 'east'
'top' or 'north'
'bottom' or 'south'
'center' or 'middle'

label(...,'TextProperty',PropertyValue) specifies text properties as name-value pairs.

label(...,'slope') attempts to angle text following the local slope of the data.

htext = label(...) returns the handle htext of the newly-created text object.

Cite As

Chad Greene (2021). label (https://www.mathworks.com/matlabcentral/fileexchange/47421-label), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: plotboxpos, ntitle, figtitle, legappend

Inspired: SI Psychrometric Chart

Community Treasure Hunt

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

Start Hunting!

label_documentation/html/