필터 지우기
필터 지우기

How can I plot lines with varying opacities/colors at each point?

조회 수: 5 (최근 30일)
Will Adler
Will Adler 2014년 2월 17일
답변: Mischa Kim 2014년 2월 17일
I have a matrix of data that shows up as 3 differently colored lines.
x=[1 2 3 4 5]
y=[2 1 2 4 3;
1 3 2 1 1;
2 1 4 5 4]
y was found by binning data with histc and then averaging those bins. I have another matrix with the number of bin observations that corresponds to each data point in y:
b=[9 9 9 9 9;
9 9 7 4 2;
9 3 3 2 1]
I want to plot(x,y), with line opacity indicating (adding varying amounts of white) bin observations. Basically, the line segments around each point would be "dimmer" if they reflect less underlying data. So in this example, the 1st line would be fully opaque, and the next two lines would decrease in opacity from left to right.
Does anyone know a good way to do this?
Thanks!

채택된 답변

Mischa Kim
Mischa Kim 2014년 2월 17일
Will, check out this answer. Just copy-paste-execute the code snippet and adapt it your needs.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by