Filling Area with gray color scale.

18 ビュー (過去 30 日間)
DAVID OYUGI
DAVID OYUGI 2019 年 6 月 26 日
コメント済み: DAVID OYUGI 2019 年 6 月 27 日
I am working on a figure and a came up with a surface area which is cone shape(plotted by two variables X and Y), and has five layers. I want to fill the area of each layer based on the intensity of gray color represented by matrix Z. The figures changes therefore i cannot save it first and modify it rather I want to modify it on the plot as facecolor. When I use imshow(I, []);, the two figures are plotted differently.
How can I fill the area (Area) with various layers of imshow(I, []) colors? Be free to use ant example or linspace to generate X, Y and Z values.
X=[j,i]; % currently j=5,the maximum value of L i=301 ,but this can change based on the variable.
Y=[j,i]; % Y is not directly related to X, but the size varies.
Z=[j,i-1]; % Z varies from 0 to max of 100 and is set to represent a measure of the intensity of the gray color
I = mat2gray(Z,[0 max(max(Z))]);
imshow(I, []);
Color=['I' 'r' 'c' 'm' 'k'];
figure(14)
hold on
for j=L:-1:1 % is set currently at 5.
Area(j,:)=area(X(j,:),Y(j,:),'FaceColor',Color(j)); %Area layers.
end
  10 件のコメント
DAVID OYUGI
DAVID OYUGI 2019 年 6 月 27 日
The figure is plotted out with values, SL=Xvalues, h=Yvalues and AFR=Zvalues as attached. But the idea is just how can I fill the area.
DAVID OYUGI
DAVID OYUGI 2019 年 6 月 27 日
Thanks one again. If I use (surf(h,SL)), the shape is rectangle.
Run the modified code below with the earlier attached matlab data, then may be you can get my case.The only part of this code I need modification is how to replace the white color with gray color scale generated by matrix AFR(or h).
Sorry for not be clear.
% Color Intensity variation over area stack.
L=5;
for j=1:L
X(j,:)=SL(j,:);
Y(j,:)=h(j,:);
Z(j,:)=AFR(j,:);
end
% I = mat2gray(Z,[0 max(max(Z))]);
% imshow(I, []);
Color=['w' 'w' 'w' 'w' 'w'];
figure(14)
hold on
for j=L:-1:1
Ar(j,:)=area(X(j,:)*1000,(Y(j,:)*1000),'FaceColor',Color(j));
Ar(j,:)=area(X(j,:)*1000,(Y(j,:)*1000)*-1,'FaceColor',Color(j));
end
axis([0 350 -100 100]);
grid on
box on
set(gca,'linewidth',1)

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by