2013-04-08 157 views
3

我有一组矢量,形状为一个n×m矩阵,我想从中计算m个叠加的n个等效图。这很容易:在MATLAB中的Normplot颜色映射

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

normplot自动为每列数据着色,但我想控制它们是如何着色的。具体而言,我需要让他们成为灰度。第一组数据(第1列)应该是白色(或接近白色),最后一组是黑色。

+0

由于我没有安装Matlab的我只能给一个链接从MathWorks公司对应的帮助页面:定义您自己的ColorOrder ](http://www.mathworks.de/de/help/matlab/creating_plots/defining-the-color-of-lines-for-plotting.html?searchHighlight=ColorOrder#brdjjco-1) – pwagner 2013-04-08 13:12:41

回答

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