How do I remove the border surrounding the legend box in MATLAB?
431 views (last 30 days)
Show older comments
I would like to remove the border surrounding the legend box in MATLAB.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
The following example demonstrates how to remove the legend border and legend background for MATLAB 5.3 (R11):
plot(rand(10,10)); % Generate a plot.
legend('a1', 'a2','a3','a4','a5','a6','a7','a8','a9','a10') % Add a legend
h = findobj('type', 'axes'); % Find all sets of axes
set(h(1), 'visible', 'off') % Hides the legend's axes (legend border and background)
The following example demonstrates how to remove the legend border and legend background for MATLAB 6.0 (R12) and later versions:
plot(rand(10,10)); % Generate a plot.
legend('a1', 'a2','a3','a4','a5','a6','a7','a8','a9','a10') % Add a legend
legend boxoff % Hides the legend's axes (legend border and background)
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!