Is it possible to reduce the alpha for markers in a simple plot?

8 Ansichten (letzte 30 Tage)
Hi all,
I am having a simple plot like
plot(X,Y, 'MarkerFaceColor','#0072BD')
Is it possible to reduce the transparency of MarkerFaceColor to 0.5?
Thanks in advance

Akzeptierte Antwort

ANKUR KUMAR
ANKUR KUMAR am 12 Mär. 2021
Bearbeitet: ANKUR KUMAR am 12 Mär. 2021
Plot function doesn't have support to tune transparency. You can use scatter to do that
scat = scatter(x,y,'MarkerFaceColor','b','MarkerEdgeColor','r');
scat.MarkerFaceAlpha = .5;
scat.MarkerEdgeAlpha = .5;
You can manipulate the color values, if you wish to use plot function.
hand = plot(X,Y,'r');
hand.LineWidth = 2;
hand.Color(4)=0.2; % this would act as your alpha value or transparency factor.
  2 Kommentare
Wolfgang McCormack
Wolfgang McCormack am 13 Mär. 2021
@ANKUR KUMAR why is the index 4? I never get indexing in plots :D
ANKUR KUMAR
ANKUR KUMAR am 15 Mär. 2021
First three indices are for RGB color, and the fourth index is the transparency.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by