Change opacity of Lines
Ältere Kommentare anzeigen
Hello everyone
I want to change the opacity of lines I plotted in a figure in MATLAB. I read somewhere about alpha and facealpha commands but couldn't figure how to use them. Could somoene please tell me how to do this?
Regards Adi
Akzeptierte Antwort
Weitere Antworten (1)
Royi Avital
am 29 Sep. 2017
7 Stimmen
In newer versions of MATLAB you can do that easily using the Color property of the line.
By default it is RGB array (1 x 3). Yet if you set it to RGBA (1 x 4) the last value is the alpha of the color.
Enjoy...
6 Kommentare
Erik Jäverbrink
am 1 Dez. 2020
This was an excellent solution!
Garvit Amipara
am 15 Apr. 2021
Spent half an hour to find a solution, here it is. Thank you!
Murphy Liu
am 7 Jul. 2021
Thank you!! I spent hours on this problem
goc3
am 17 Sep. 2021
This question should be updated to have this as the selected answer!
Greta Koumarianou
am 7 Okt. 2021
this does not work on 2021a. bit of an embarassment for matlab
Soheil
am 4 Mai 2022
The following works in R2021b (64-bit, Windows). The last value changes the transparency:
'Color',[0 0.4470 0.7410 0.1]);

Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!