How do I color an area between 3 graphs ?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have created a plot in which my graph is set up with 2 more graphs serving as upper und lower boundaries (confidence intervals) indicating at which time my graph becomes significant. Now I would like to color the area within the boundaries in a light grey tone, so that I will get a grey "tube" which makes the whole plot visually a bit more appealing. Could anyone give me some advice? My graph is called meanRandLike containing 1000 permutations of my original data and graph. This is the function:
Matlab Code
function [meanRandLike] = Like_Conf(meanRandLike)
s=sort(meanRandLike,2);
bounds = prctile(s',[2.5,97.5]);
%keepvals = s(s>=bounds(1) & s<=bounds(2));
plot(bounds(1,:),'b');
hold on
plot(bounds(2,:),'r');
end
0 件のコメント
回答 (2 件)
Matt Tearle
2011 年 3 月 13 日
Something like this?
function [meanRandLike] = Like_Conf(meanRandLike)
s=sort(meanRandLike,2);
bounds = prctile(s',[2.5,97.5]);
x = 1:size(bounds,2);
%keepvals = s(s>=bounds(1) & s<=bounds(2));
plot(x,bounds(1,:),'b',x,bounds(2,:),'r');
patch([x,fliplr(x)],[bounds(1,:),fliplr(bounds(2,:))],...
[0.9,0.9,0.9],'LineStyle','none');
set(gca,'children',flipud(get(gca,'children')))
% just for illustration, let's add the line in the middle
line(x,prctile(s',50),'color','k')
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!