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
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!