File Exchange

image thumbnail

resize_legend

version 1.0.0.0 (2.37 KB) by Denis Gilbert
Changes LEGEND fontsize.

3 Downloads

Updated 28 Sep 2004

View License

Changes LEGEND fontsize while maintaining proper alignment between the legend's text strings and line symbols.

Example: Double the fontsize

hLeg = legend(h,'string1','string2',...);
resize_legend(hLeg, 2);

See graphics snapshot below for a DEMO.

Cite As

Denis Gilbert (2020). resize_legend (https://www.mathworks.com/matlabcentral/fileexchange/2190-resize_legend), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

Rounak

This code cannot work in R2014b or later.
Code uses legend's children to increase the font size. There are no children of legend in aforementioned versions of Matlab.

https://www.mathworks.com/help/matlab/graphics_transition/why-is-the-children-property-empty-for-some-objects.html

Matlab has implemented this as built-in functions from R2014b. Please check the examples on

https://www.mathworks.com/help/matlab/ref/legend.html

Rounak

Not working with Matlab R2016a.
Tried resize_test.m (included file)
Showing below error.

l=legend(...)
get(l,'Children')
% returns
% 0x0 empty GraphicsPlaceholder array

Barry

Michael Wirtz

it's really helpful. thx

shirley du

it's really helpful. it's what i want to achieve in my code. and Thank you!

Joel Sander

Very helpful...controlled resize of legends was exactly what I was trying to learn to do...Thanks

Updates

1.0.0.0

MATLAB 7 compatibility change

MATLAB Release Compatibility
Created with R11.1
Compatible with any release
Platform Compatibility
Windows macOS Linux