How do I color an area between 3 graphs ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Matt Tearle
am 13 Mär. 2011
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 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!