How to overlay pcolour figures?

조회 수: 10 (최근 30일)
Chameleon17
Chameleon17 2015년 10월 9일
댓글: Chameleon17 2015년 10월 9일
Good afternoon,
I am after a bit of advice again, if anyone has any time.
I've looked in the directory and at previous questions but can't seem to see a clear solution to my problem and I suspect that there is one.
I have five matrixes, (501,501,5). They show plume spread. I can plot each individually with pcolor no problem.
Is there a way to overlay the five into one figure?
Thanks for any help, advice, direction!

답변 (2개)

Mike Garrity
Mike Garrity 2015년 10월 9일
The pcolor function simply creates a surface object with color but no Z. You can set the FaceAlpha property on that to make it transparent.
[x,y] = meshgrid(linspace(-pi,pi,40));
h(1) = pcolor(cos(x).*cos(y));
hold on
h(2) = pcolor(sin(x).*sin(y));
hold off
h(2).FaceAlpha = .5;
  댓글 수: 1
Chameleon17
Chameleon17 2015년 10월 9일
hmm, maybe I'm applying it to my code wrong, but it just turns everything black?

댓글을 달려면 로그인하십시오.


Kelly Kearney
Kelly Kearney 2015년 10월 9일
Alternatively, assuming each dataset holds a zero wherever the plume is not, and the plume regions themselves don't overlap too much, you set the 0-values to NaN.
[x,y] = meshgrid(linspace(0,1,100));
a = exp(-((x-0.1).^2./0.1 + (y-0.1).^2)./0.1);
b = exp(-((x-0.9).^2./0.1 + (y-0.9).^2)./0.1);
a(a < 0.01) = NaN;
b(b < 0.01) = NaN;
pcolor(x,y,a);
hold on;
pcolor(x,y,b);
shading flat;
  댓글 수: 1
Chameleon17
Chameleon17 2015년 10월 9일
Thank you for that.
I'm not sure if this bad or not, but in the end I've just added my five matrices together and plotted the result. It looks like what I was after. I'll need to think what's wrong with doing it this way though.
Thank you guys for your advice and help! Much appreciated!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by