필터 지우기
필터 지우기

how to apply a uniform color gradient to a patch object

조회 수: 4 (최근 30일)
Ramiro Massol
Ramiro Massol 2015년 5월 20일
편집: Star Strider 2015년 5월 20일
hi I'm trying to show a filled histogram of selected images. The fill" area under the curve will indicate the color assignment determined by a user-specified colormap. I'm using a patch object to create the filled area. The problem I have is that the shading of the patch is not uniform from left to right, i.e. I expected vertical slabs of color but instead the patch shows odd diagonal-like shading that I have no idea how to remove. I I'm not sure what I'm doing wrong. A code that reproduces this behavior is shown below:
x = log10(sort(randi([900 65535],1,256)));
y = log10(randi([1 150000],1,256));
X = [x(1) x x(end)];
Y = [0 y 0];
cmap = colormap(gray(258));
figure
hline = line(x,y,'Color','r','LineStyle','-','LineWidth',2);
hold on
patch('Faces',1:size(X,2),'Vertices',[X' Y'],'FaceVertexCData',cmap,'FaceColor','interp')
hold off
Please help! best Ramiro email: rhmassolc@yahoo.com; ramiro.massol@biogen.com

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by