Color gradient with linspace inside scatter.
Ältere Kommentare anzeigen
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!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu White finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!