Shade between time series lines (log-y scale)
古いコメントを表示
Hello,
I'm attempting to plot between two lines on a graph that's set to a log-y scale. I've tried almost every iteration of the "fill" command that seems to appear from various sources online, which usually gives me somewhat psychedelic (but useless) results.
Suppose that:
x = 0:100
y1 = rand(1,100)+1.5
y2 = rand(1,100)+0.5
How can I fill just between the y1 and y2 lines??? I want nothing but empty space below the y2 line. Also, this is on a log-y scale, which is why I can't just tweak the "area" commands (like I did for a similar project that was not on a log-y scale.
Please help!!!
Thanks, Ryan
採用された回答
その他の回答 (3 件)
Venn Ravichandran
2012 年 1 月 19 日
0 投票
Using stem plot might be a quick work around. I don't know why the area plots don't work.
the cyclist
2012 年 1 月 19 日
Will this suffice?
x = 1:100;
y1 = rand(1,100)+1.5;
y2 = rand(1,100)+0.5;
figure
plot(x,y1,x,y2)
fill([x,fliplr(x)],[y1,fliplr(y2)],'r')
set(gca,'YScale','log')
[Edited to include the additional fliplr, in response to Walter's comment.]
1 件のコメント
Walter Roberson
2012 年 1 月 19 日
I think you have to flip y2 as well.
Amusing that we choose the same color and same basic technique :)
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!