2017-02-06 46 views
0

我使用八度繪圖()函數繪製二維圖形上的散點。然後我使用contour()函數在點上繪製輪廓。但contour()函數在點之上不重疊。會發生什麼情況是,即使使用HOLD ON命令,散點圖圖形也會完全由輪廓線代替。 我有這樣的事情:如何繪製八度散點圖頂部的計數曲線

plot(); %plot the x,y scatter plot 
hold on; %hold on to be able to add to the plot 
contour(); %Add the contour on top of the scatter plot 

我不知道是否有人可以顯示一些示例代碼,他們可以展示給輪廓添加到現有的情節。

感謝

+0

您是否試過交換訂單? –

回答

1

下面是一個例子:

x = [-10:0.1:10]; 
    y = x .^ 2; 
    z = x' * x; 
    hold on; 
    contour(x,y,z); 
    plot(x,y); 

會產生此圖(藍色,你可以看到的情節發佈的拋物反射)。

enter image description here