Why does the legend not resize when I modify the legend font size in MATLAB 7.0 (R14)?
3 views (last 30 days)
Show older comments
I create a simple plot with a legend using the following code:
plot(rand(4))
h_legend=legend('One','Two','Three','Four');
get(h_legend,'Position')
h_text = findobj(h_legend,'type','text');
set(h_text,'FontUnits','points','FontSize',4)
get(h_legend,'Position')
The legend box does not change to fit the text.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
There is a bug in MATLAB 7.0 (R14) that prevents the legend box size from being properly updated when accessed in the manner shown.
To work around this issue, update the legend font size by using the legend handle directly:
set(h_legend,'FontSize',4)
This will update the legend box size automatically.
0 Comments
More Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!