yline color in rgb

48 vues (au cours des 30 derniers jours)
Frederik Reese
Frederik Reese le 5 Juil 2022
Réponse apportée : Andres le 5 Juil 2022
Hi,
I have a plot and want to add a yline.
If I plot it like this it works:
yl1=yline(-0.25,'m','Freibord 75% ausgenutzt','HandleVisibility','off')
But I want a color, which has not a single letter.
I tried this:
yl1=yline(-0.25,'Freibord 75% ausgenutzt','HandleVisibility','off')
yl1.LineColor =[0.8500 0.3250 0.0980]
and this:
yl1=yline(-0.25,'#D95319','Freibord 75% ausgenutzt','HandleVisibility','off')
Both doesn't work....
Why?

Réponses (1)

Andres
Andres le 5 Juil 2022
Hi,
the LineSpec argument is limited to some specific line style characters plus color short name characters listed in the documentation of yline.
Use e.g.
yl1=yline(-0.25,'-','Freibord 75% ausgenutzt','HandleVisibility','off',...
'Color','#D95319');
or
yl1.Color = [0.8500 0.3250 0.0980];

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!