I am trying to plot the confidence intervals for males and females on my graph. I have been using simple line plots for the female and male data and their upper and lower confidence intervals, using the following code
x=[5,610,1115,1620,2125,2630,3135,3640,4145,4650];y=[1.5728,1.6011,1.5828,1.583,1.5779,1.5931,1.6136,1.6132,1.6354,1.6512];CI = [0.047204964 0.020555517 0.030005595 0.023338819 0.030057518 0.026567109 0.027295407 0.025855224 0.029278635 0.028793178]; %CI values
y2 = [1.4904,1.625,1.5834,1.6213,1.6135,1.6378,1.6212,1.6563,1.662,1.6657,1.6462,1.7267]x2 = [5,610,1115,1620,2125,2630,3135,3640,4145,4650, 5155, 5660]CI2 = [0,0.02859404,0.03932538,0.031767406, 0.033377728,0.033181883,0.02925182, 0.030260765,0.028698134,0.026206678,0.035101913,0]plot(x, y, 'color', [0, .6, .77])hold onplot(x, y-CI, ':', 'color', [0, .6, .77])hold onplot(x , y+CI, ':','color', [0, .6, .77])hold onplot(x2, y2, 'color', [.89, 0, .23])hold onplot(x2, y2-CI2, ':', 'color', [.89, 0, .23])hold onplot(x2 , y2+CI2, ':','color', [.89, 0, .23])hold offylabel('vTMD')xlabel('Depth (%)')xticks([5, 610, 1115, 1620, 2125, 2630, 3135, 3640, 4145, 4650, 5155, 5660])xticklabels({'0-5', '6-10', '11-15', '16-20', '21-25', '26-30', '31-35', '36-40', '41-45', '46-50', '51-55', '56-60'})
This gives me a graph that looks like this –
Is there a way to shade the individual CI as it is pretty hard to read right now! For example, a lighter blue in between the dashed blue lines.
Best Answer