how to apply a uniform color gradient to a patch object

6 次查看(过去 30 天)
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