Clear Filters
Clear Filters

Increasing number of interpolating color in patch

1 view (last 30 days)
Hi all,
I have created a patch with the color varying between two random colors. However, I would like to increase the number of interpolating colors.
Here we can see the shading are quite obvious.
Could you please help
x = [0 1 1 0];
y = [0 0 1 1];
c1 = [0.55 0.95 0.35];
c2 = [.65 .75 .55];
cdata(1,1,:) = c2;
cdata(1,2,:) = c2;
cdata(1,3,:) = c1;
cdata(1,4,:) = c1;
p =patch(x,y,'k');
set(p,'CData',cdata, ...
'FaceColor','interp', ...
'EdgeColor','none');
  7 Comments
David Wilson
David Wilson on 13 Apr 2019
I agree, the banding problem is quie subtle, and could well be an issue with your monitor.
One option is to subdivide your patch into say quadrants, and then interpolate the RGB values accordingly, and then plot all 4 as 4 separate patches. I'm assuming that will double the effective resolution & therefore reduce the banding.
Walter Roberson
Walter Roberson on 13 Apr 2019
When I look at the grayscale picture on my smartphone, then I can just barely see a band near the top, and only by scrolling back and forth. I might see a second band, but it is down in the level where it could be the power of suggestion. When I look at the grayscale picture on my iMac 27", I cannot reliably see any banding.
I also tried with using [0 0 0] [1 0 0] [0 1 0] [0 0 1] in the four corners. I could not see any banding at all.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!