Color gradient with linspace inside scatter.
이전 댓글 표시
Hello, I'm generating a set of aligned circles with scatter, and I'd like each of the circle to have an individual color according to a color gradient. I'd like to generate this gradient as an array of dimension N, from an initial color to a final color, with the command linspace. That's a solution I initially came up with:
color=linspace(start_color,end_color,N);
scatter(p(1,1:N),p(2,1:N),color,'filled');
p(1,:) are the x coordinates of the circles. p(2,:) are the y coordinates of the circles.
What went wrong was that whatever the start_color/end_color values are I always ended up having kind of the same blue to yellow gradient. I'd also like to have access to the whole color spectrum. How can I fix this problem? Thanks in advance!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 White에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!