setting transparancy of legend?
Afficher commentaires plus anciens
Is it possible to make the background of the legend be slighly transparent so that the lines behind it can be somewat visible?
1 commentaire
Walter Roberson
le 16 Jan 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.
Réponse acceptée
Plus de réponses (3)
alice
le 27 Juin 2017
4 votes
In undocumented Matlab, you will find how to do it here: http://undocumentedmatlab.com/blog/transparent-legend.
3 commentaires
Walter Roberson
le 17 Déc 2019
Miquel
le 31 Jan 2020
Awesome, guys! Thanks :)
Hakon Haugnes
le 17 Août 2023
echo that: awesom
Ilja Maljutenko
le 19 Mai 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.
Wilson A N
le 16 Jan 2017
Modifié(e) : Walter Roberson
le 16 Jan 2017
0 votes
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 commentaires
Walter Roberson
le 16 Jan 2017
Modifié(e) : Walter Roberson
le 16 Jan 2017
Unfortunately changing the Color property does not allow you to set transparency: it is still going to completely hide any line underneath.
There are some parts of HG2 which have quietly introduced allowing a quad to be specified instead of a color triple in order to put in transparency, but unfortunately legends do not have that as yet.
James Richard
le 17 Déc 2019
Any news on this?
Catégories
En savoir plus sur Legend dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
