File Exchange

image thumbnail

Add a title to a legend

version 1.2.0.0 (1.8 KB) by Robert Cumming
Add a title to a legend - compatible with R2014b

2 Downloads

Updated 18 Dec 2014

View License

The introduction of HG2 has removed an (undocumented) feature of legends - the ability to easily add titles to them.
This function is to replace/replicate that behaviour.
The function works on both HG1 and HG2.
hTitle = legendTitle ( hLegend, 'your title string' );
The function accepts arg pairs to format/customise the legend.
Function has listeners for the legend changing "Location", "Position" and being Deleted. A listener is also added to the parent figure when it changes size.

This submission is part of the matpigui toolbox (available from www.matpi.com)

Comments and Ratings (5)

thanks, does work in R2015b

Falk Lieder

David Rayner

Works better than submission #4561 (legendtitle), specially after saving figure as a png file. (You might wish to "acknowledge" that submission so that it links back to the present one.)

Updates

1.2.0.0

Update to link other pre-HG2 FEX to help users find this submission

1.1.0.0

Fix bug in the test script.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Acknowledgements

Inspired by: LEGENDTITLE