How to have MATLAB 2016 Legend without box and as transparent?
7 views (last 30 days)
My proposal but I cannot get it work in MATLAB 2016b
f = figure;
hax = axes(f);
[BL,BLicons] = legend(hax, 'lorem');
PatchInLegend = findobj(BLicons, 'type', 'patch');
set(PatchInLegend, 'facea', 0.5);
Syntax in Docs correspond to icons as `[lgd,icons,plots,txt] = legend(_)`.
Expected output: no box around the legend and transparency.
I have also tried unsuccessfully; which is what I have literally
[BL, BLicons] = legend( bFigHax, sprintf('Tc'), 'Box', 'off', ...
'Location', 'southwest', 'color', 'none');
MATLAB: 2016b OS: Debian 8.5
Kirby Fears on 24 Oct 2016
Edited: Kirby Fears on 24 Oct 2016
Check out the Matlab documentation on the legend function. Special arguments can be passed in as name value pairs when creating the legend. https://www.mathworks.com/help/matlab/ref/legend.html#namevaluepairarguments
The full list of names you can specify values for is here: https://www.mathworks.com/help/matlab/ref/legend-properties.html
The box can be removed by specifying
I don't see any options to make the legend background transparent, but you can change the background color using the 'Color' argument. The transparency setting you found on stackoverflow is specifically referring to the transparency of the green color patches displayed within the legend shown. If that's what you're after, their example should work.