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!