setting transparancy of legend?
258 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Micke Malmström
el 12 de En. de 2017
Is it possible to make the background of the legend be slighly transparent so that the lines behind it can be somewat visible?
1 comentario
Walter Roberson
el 16 de En. de 2017
I will not say that it is impossible at the moment. It is certainly not documented. You just might be able to change it using one of the hidden properties of the legend. Perhaps one of the ColorSpace properties. Nothing I have tried has worked yet.
Respuesta aceptada
Afiq Azaibi
el 26 de Abr. de 2024
Editada: Adam Danz
el 30 de Abr. de 2024
Starting in R2024a, legend supports the ability to control the level of transparency with the BackgroundAlpha property. Below is a short example:
plot(magic(7));
grid on;
set(gca, 'Color', [.88 .88 .88]);
l = legend(BackgroundAlpha=.7);
Setting the value to 0 will make it fully transparent and a value 1 of will make it fully opaque which is the default behavior.
Other answers in this thread address solutions prior to R2024a.
0 comentarios
Más respuestas (3)
alice
el 27 de Jun. de 2017
In undocumented Matlab, you will find how to do it here: http://undocumentedmatlab.com/blog/transparent-legend.
3 comentarios
Ilja Maljutenko
el 19 de Mayo de 2021
This solution seems to work in Matlab 2020 +
h_leg.BoxFace.ColorType='truecoloralpha';
h_leg.BoxFace.ColorData=uint8(255*[1 1 1 0.75]');
where h_leg is your legend box handle.
0 comentarios
Wilson A N
el 16 de En. de 2017
Editada: Walter Roberson
el 16 de En. de 2017
You can refer to the link given below on how to set the different properties of legend
To change the background color of the legend you can change the 'Color' field to achieve the required transparency.
3 comentarios
Ver también
Categorías
Más información sobre Legend en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!