Line graph shading?
32 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a line graph with quite a few different lines drawn it. I want to shade regions between a couple of the lines to represent/highlight the area. Is there a function or a method i can use to do such a thing?
Cheers for any help given in advance Regards Rob
0 件のコメント
採用された回答
Daniel Shub
2011 年 11 月 9 日
The fill command can do this. It requires some careful control of the ordering of the points and the ordering of the lines (hence the fliplr in the example below) ...
doc fill
x = 1:10;
y1 = 1:10;
y2 = 2:11;
h = fill([x, fliplr(x)], [y1, fliplr(y2)], 'r')
You can make it transparent with
set(h, 'FaceAlpha', 0.5)
その他の回答 (1 件)
Fangjun Jiang
2011 年 11 月 9 日
I am not aware of any function for it. If you can get the intersection points, or just define the points, you can use patch().
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!