簡體   English   中英

MATLAB:帶有色標的色標

[英]MATLAB: color scale with probplot

我有兩個長度, 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函數結合使用?

我努力了:

  • 'parula'代替[0.5 0.5 0.5]
  • parula替換[0.5 0.5 0.5]
  • 用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功能之一。 我可以仔細研究一下,但是在開始執行此操作之前,誰能指出我所擅長的資源?

謝謝你的幫助。

嘗試這個:

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM