MATLAB中的Normplot colormap

3

我有一组向量,形状为n乘m的矩阵,我想要计算m个正态概率图并叠加。这很简单:

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

normplot会自动为每列数据上色,但我需要控制它们的颜色。具体来说,我需要将它们变成灰度色。第一组数据(第一列)应该是白色(或接近白色),而最后一组数据应该是黑色。


由于我没有安装Matlab,所以我只能提供MathWorks相应帮助页面的链接:定义自己的ColorOrder - wagnerpeer
1个回答

3
通过获取绘制线条的句柄,您可以像这样操作:
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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接