2016-04-11 46 views
0

いくつかの散乱点に基づいて2本の線をプロットしましたが、今度は2本の線の間の領域を塗りつぶす必要があります。2本の線の間に塗りつぶす

counts_dataset = dataset('file','file.txt','Delimiter','\t'); 
x = counts_dataset.x; 
y1 = counts_dataset.y1; 
y2 = counts_dataset.y2; 

line1 = line(x, y1,'Color', [.8 .8 .8]) 
line2 = line(x, y2,'Color', [.8 .8 .8]) 

私が今ほど二行の間の領域を埋めるためにしようとしています:

fill([x fliplr(x)],[y2 fliplr(y1)],'c') 

しかし、これは私にこのプロットを与える:enter image description here

散布ポイント

を無視

フィル機能を正しく使用していませんか?どのように私は2つの線の間に影をつけることができますか?

+0

関連:http://stackoverflow.com/questions/7350140/two-time-series-plots-and-shading-between-them- matlab – Amro

答えて

1

おそらく、データに問題があります。次のコードは、正確に何をしたいん:

x = 1:10; 
y1 = sin(x) + 3; 
y2 = sin(x); 
fill([x fliplr(x)], [y2 fliplr(y1)], 'c') 

Resulting plot

+0

ありがとうございます。私はそれを調べます – interstellar

関連する問題