3

m 個のノルムプロットを重ね合わせて計算したい x m 行列の形をした一連のベクトルがあります。かんたんだよ:

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

ノルムプロットはデータの各列に自動的に色を付けますが、色の付け方を制御したいと思います。具体的には、グレースケールにする必要があります。データの最初のセット (列 1) は白 (または白に近い) で、最後の 1 セットは黒でなければなりません。

4

1 に答える 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

ここに画像の説明を入力

于 2013-04-08T13:36:21.053 に答える