필터 지우기
필터 지우기

What does Color(1-4) mean?

조회 수: 10 (최근 30일)
Cliff Karlsson
Cliff Karlsson 2018년 9월 17일
답변: Walter Roberson 2018년 9월 17일
When trying to set alpha for lines in a parallelcoords-plot I stumbled on the command:
lineobject(i).Color(4) = 0.5;
It works but I don't understand what the number "4" means? When trying different inputs I noticed that Colors accepts integers in the range 1-4 and 1-3 looks to be specific hues of red, green and blue. But what does "4" mean and why do I have to specify Color(4) to be able to set the alpha?

채택된 답변

Walter Roberson
Walter Roberson 2018년 9월 17일
Those particular kind of graphics object accept a color specification which is in the form of a four element vector of doubles in the range 0 to 1. The elements are in the order R G B A. So Color(1) would be the red component, (2) would be the green component, (3) would be the blue component, and (4) is the alpha component.
Depending on the kind of graphics object, the fact that it accepts alpha components might not be documented.
Also, a number of the graphics objects that are not documented as accepting alpha expect uint8 values for the RGBA specification.

추가 답변 (0개)

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by