3

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.

1

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.