MATLAB:带有probplot的色标

问题描述 投票:0回答:1

我有两个相同长度的一维矢量,datamy_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
  • 用m行3列双矩阵替换[0.5 0.5 0.5],其中每行具有parulamy_parameter映射到的rgb值。 (所以m是my_parameter的长度。)
  • 摆脱set(h, 'color', [0.5 0.5 0.5]);线,并在设定线下方添加一条线colormap(parula);

如果没有办法直接使用probplot函数,因为它是如何编写的(例如,如果它被编写为只接受3元素向量),我想我将不得不尝试重写我自己的probplot版本使用其中一个scatter函数。我可以四处寻找并解决这个问题,但在我开始这样做之前,是否有人能指出我已经完成这项工作的资源?

谢谢你的帮助。

matlab plot probability colormap
1个回答
0
投票

试试这个:

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,:)

以上产生了这个:enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.