[英]MATLAB: color scale with probplot
我有兩個長度, 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函數結合使用?
我努力了:
'parula'
代替[0.5 0.5 0.5]
。 parula
替換[0.5 0.5 0.5]
。 [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,:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.