2014-02-10 34 views
0

我有一個包含3個向量X,Y和Z的數據集,我想繪製該數據集的二維圖像。我不知道如何定義X,Y和Z,顏色是不同的Z.你有什麼想法如何做這個任務?如何使用數據繪製二維圖像

在此先感謝

+0

你試過構建[位圖(http://msdn.microsoft.com/en-us/library/system.drawing.bitmap(v = vs.110)的.aspx)? –

+0

是常規網格上的x和y座標嗎?否則使用[**'scatter' **](http://www.mathworks.es/es/help/matlab/ref/scatter.html)。一些靈感你可以finde [**這裏**](http://stackoverflow.com/questions/21658031/plot-x-y-z-triplets-over-coordinates-x-y-with-color-z/21658182#21658182)! (只考慮使用'scatter'的部分) – thewaywewalk

+1

x和y在常規網格中,我想要做與熱圖匹配的圖譜完全相同的圖譜matlab – user3177755

回答

1

這將是一個有點慢,如果有幾千點,但應該工作:

>> x=1:10; 
>> y=x.^2; 
>> z=y/10; 
>> cmap = jet(64); % Define a color map 
>> idx = ceil(z/max(z)*64); % Indices into the map 
>> figure 
>> hold on 
>> for i=1:length(x);plot(x(i),y(i),'o','Color',cmap(idx(i),:));end 

我喜歡在Plot (x,y,z) triplets over coordinates (x,y) with color z的建議雖然

相關問題