Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Normplot colormap in MATLAB

I have a set of vectors in the shape of a n by m matrix from which I would like to calculate m normplots superimposed. This is easy:

c=rand(100,10);
figure
normplot(c)

The normplot automatically colors each column of data, but I would like to control how they are colored. Specifically I need to make them greyscale. The first set of data (column 1) should be white (or close to white) and the last one black.

like image 533
Christian Lundmand Jensen Avatar asked Dec 11 '25 20:12

Christian Lundmand Jensen


1 Answers

By obtaining the handles to the plotted lines you could something like this:

close all;
n = 100;
m = 10;
doc=rand(n,m);
figure;

% obtain the handle h to the dotted lines
h = normplot(doc);

% define colormap
g = colormap('gray');

for i = 1:m
    %set(h([1 11 21]),'color','r') % to set color to red
    %set(h([1 11 21]),'marker','o') % to change marker

    % mapping into greyscale color map (g has size 64x3)
    set(h([i i+m i+2*m]),'color',g(round(i * size(g,1)/m),:));
end

enter image description here

like image 142
Tobias Avatar answered Dec 14 '25 16:12

Tobias



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!