gpt4 book ai didi

matlab - MATLAB 中的 Normplot 颜色图

转载 作者:太空宇宙 更新时间:2023-11-03 20:30:37 25 4
gpt4 key购买 nike

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

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

normplot 自动为每列数据着色,但我想控制它们的着色方式。具体来说,我需要将它们设为灰度。第一组数据(第 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

enter image description here

关于matlab - MATLAB 中的 Normplot 颜色图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15879418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com