Is is possible to move the LEGEND in a figure once the 'box' is turned 'off' in MATLAB?
10 views (last 30 days)
Show older comments
I am trying to create a transparent bounding box for my legend in a figure. When I execute the following commands:
figure ; plot(1:10);
hl = legend('test', 'location', 'NorthEastOutside');
legend('boxoff')
I am unable to move the legend.
Accepted Answer
MathWorks Support Team
on 2 Oct 2009
The ability to move the LEGEND when the BOX is turned 'off' is not available in MATLAB.
As a workaround, you can set the 'XColor', 'YColor' and 'Color' properties of the axes object appropriately. For example, see code below:
figure ; plot(1:10);
hl = legend('test', 'location', 'NorthEastOutside');
set(hl, 'XColor', 'w', 'YColor', 'w', 'Color', 'none');
This will make the legend axes transparent with white borders, and still allow the user to drag the legend in the figure.
0 Comments
More Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!