selected = findobj(allLines,'Type','line','LineWidth',0.5);
set(selected, 'MarkerFaceAlpha',.2,'MarkerEdgeAlpha',.2);
Error using matlab.graphics.chart.primitive.Line/set
Unrecognized property MarkerFaceAlpha for class Line.
Error in mycallback (line 19)
set(selected, 'MarkerFaceAlpha',.2,'MarkerEdgeAlpha',.2);
Error while evaluating Line ButtonDown
Hi, i try to color in trasparente mode but i get error

 Respuesta aceptada

Matt J
Matt J el 7 de Jun. de 2025
Editada: Matt J el 7 de Jun. de 2025
It's undocumented, I believe, but you can control line transparency by setting the Color property to a 4-element RGBA value.
h=plot(rand(5,2),'r', 'LineWidth',4);
set(h(2),'Color',[1,0,0, 0.2]);

3 comentarios

shamal
shamal el 7 de Jun. de 2025
thanks but changing the color I saw that it creates new problems I should just try to make them more transparent without changing the color
Matt J
Matt J el 7 de Jun. de 2025
Editada: Matt J el 7 de Jun. de 2025
What I gave you in my example does precisely that. Both lines in the plot are red, but the second line has transparency alpha=0.2. That's what a transparent red line looks like (on a white background).
Walter Roberson
Walter Roberson el 7 de Jun. de 2025
Note:
If you serialize a plot (such as save and restore, or send it between parallel workers), then the transparancy set in this manner will be discarded.

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 7 de Jun. de 2025

1 voto

Line objects have never supported MarkerFaceAlpha or MarkerEdgeAlpha
MarkerFaceAlpha and MarkerEdgeAlpha are used for Scatter plots.

1 comentario

shamal
shamal el 7 de Jun. de 2025
What do you recommend to make the plotted lines more transparent without changing the color?

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Preguntada:

el 6 de Jun. de 2025

Comentada:

el 7 de Jun. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by