MATLAB Answers

Overlap two pcolor with different color and set up transparency

조회 수: 34(최근 30일)
Xin
Xin 22 Feb 2017
댓글: Xin 23 Feb 2017
I have two figures like below.
What I want to do is 1) overlap them into one figure. 2) set transparency at the place where they meet each other. The colour can be changed, can be any color where an overlap will look nice.
Many thanks

  댓글 수: 1

Shaibal Ahmed
Shaibal Ahmed 22 Feb 2017
I have a similar question, would be great if someone could answer it.

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

채택된 답변

Chad Greene
Chad Greene 23 Feb 2017
What about this?
% Some sample data:
[X,Y,Z1] = peaks;
Z2 = flipud(Z1);
% Blue layer:
p1 = surf(X,Y,zeros(size(Z1)),'AlphaData',Z1,...
'FaceAlpha','interp',...
'FaceColor','blue',...
'edgecolor','none');
% Red layer:
hold on
p2 = surf(X,Y,zeros(size(Z2)),'AlphaData',Z2,...
'FaceAlpha','interp',...
'FaceColor','red',...
'edgecolor','none');
view(2)
grid off

  댓글 수: 1

Xin
Xin 23 Feb 2017
Thanks for your reply! Another issue is that the two figure has different colormap, how would you deal with it? Is it possible to put two different colormap together in one figure?

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by