Apply colormap to plot(x,y)
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi. I am plotting optical bandpass filters from measurments and want to colour each point depending on where it is on the spectrum. My x values are wavelength (488 = blue, 532 = green and 670 = red). For each point i plot, I want to be able to plot it in a colour that represents its true colour.
Im not sure how to firstly create the colormap, and secondly apply this to the plot(x,y function).
0 Kommentare
Akzeptierte Antwort
Andrew Newell
am 11 Mai 2011
EDIT: Here is a little demo.
n = 20;
x = rand(n,1); y = rand(n,1); spect = linspace(300,830,n);
sRGB = spectrumRGB(spect);
sRGB = squeeze(sRGB); % For some reason spectrumRGB returns a 3D array
figure; hold on
for i = 1:n
line(x(i),y(i),'Marker','*','Linestyle','none','Color',sRGB(i,:))
end
spectrumlabel(gca)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Color and Styling 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!