【问题标题】:Normplot colormap in MATLABMATLAB 中的 Normplot 颜色图
【发布时间】:2013-04-08 12:46:06
【问题描述】:

我有一组形状为 n × m 矩阵的向量,我想从中计算叠加的 m 个范数图。这很简单:

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

normplot 自动为每列数据着色,但我想控制它们的着色方式。具体来说,我需要使它们成为灰度。第一组数据(第 1 列)应为白色(或接近白色),最后一组数据为黑色。

【问题讨论】:

标签: matlab plot color-mapping


【解决方案1】:

通过获取绘制线的句柄,您可以像这样:

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

【讨论】:

    猜你喜欢
    • 2011-09-16
    • 2018-04-27
    • 1970-01-01
    • 2017-09-21
    • 1970-01-01
    • 1970-01-01
    • 2016-01-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多