필터 지우기
필터 지우기

colormap for facealpha and range

조회 수: 1 (최근 30일)
ankit agrawal
ankit agrawal 2015년 8월 25일
댓글: ankit agrawal 2015년 8월 25일
I have plotted concentric sphere of different radii with different color and different FaceAlpha.
The radius ranges from linspace(1,1/20,10) and FaceAlpha range from logspace(1,0.1,10)./10
If you see carefully small radius of sphere has high FaceAlpha value and larger radius of sphere has low FaceAlpha value. So outer most sphere should have maximum colormap value. But the colormap bar is misleading. Its showing the maximum value in the middle sphere but its not. How should i correct this.
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 8월 25일
Please show your code.
ankit agrawal
ankit agrawal 2015년 8월 25일
n=10;
r = linspace(20/20,1/20,n);
d = logspace(1,0.1,n)./10;
figure;
axes;
hold on;
[xu,yu,zu] = sphere;
for ii = 1:n
x = xu*r(ii);
y = yu*r(ii);
z = zu*r(ii);
c = ones(size(z))*d(ii);
surf(x,y,z,c,'FaceAlpha',d(n-ii+1),'EdgeColor','none');
end
view(3);
axis equal;
%set(gca,'clim',[-20,20]);
cmap=colormap; n=size(cmap,1);
d = logspace(1,0.1,n)./10;
r = linspace(20,1,n);
for ii=1:n
map(ii,:)=[d(ii),d(ii),d(ii)];
end
colormap(cmap.*map)

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by