how to apply a uniform color gradient to a patch object
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Polygons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!