我有两个相同长度的一维矢量,data
和my_parameter
。我使用probplot
查看数据的概率图,如下所示:
h = probplot(gca, data);
% in next line, want color based on my_parameter, not static color as used.
set(h, 'color', [0.5 0.5 0.5]);
set(h, 'marker', '.');
我想通过my_parameter
着色,目标是看看my_parameter
的某些值是否会抛弃分布的正常性。有没有办法使用色标,例如parula
,以及probplot函数?
我试过了:
[0.5 0.5 0.5]
替换'parula'
。[0.5 0.5 0.5]
替换parula
。[0.5 0.5 0.5]
,其中每行具有parula
将my_parameter
映射到的rgb值。 (所以m是my_parameter
的长度。)set(h, 'color', [0.5 0.5 0.5]);
线,并在设定线下方添加一条线colormap(parula);
。如果没有办法直接使用probplot
函数,因为它是如何编写的(例如,如果它被编写为只接受3元素向量),我想我将不得不尝试重写我自己的probplot
版本使用其中一个scatter
函数。我可以四处寻找并解决这个问题,但在我开始这样做之前,是否有人能指出我已经完成这项工作的资源?
谢谢你的帮助。
试试这个:
x=rand(1,15); % dummy data to plot
probplot(x)
h = probplot(gca,x);
c = parula(10);
% this changes the color of the 'x' marks to be the first row of the parula matrix
h(1).Color = c(1,:);
% this changes the color of the dashed line to be the 9th row of the parula matrix
h(2).Color = c(9,:)