Replace lines with curved lines on my graph
Show older comments
I currently have a graph with two sets of data and their confidence intervals at 95%. However, I have been requested to change these lines to curved lines between the data points. I'm very new to Matlab, could anyone assist?
Here is the graph currently:

The code I am currently running:
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 on
plot(x, y-CI, ':', 'color', [0, .6, .77])
hold on
plot(x , y+CI, ':','color', [0, .6, .77])
hold on
plot(x2, y2, 'color', [.89, 0, .23])
hold on
plot(x2, y2-CI2, ':', 'color', [.89, 0, .23])
hold on
plot(x2 , y2+CI2, ':','color', [.89, 0, .23])
patch([x fliplr(x)], [y-CI fliplr(y+CI)], [0.4, .76078, .85882], 'FaceAlpha',0.5, 'EdgeColor','none')
patch([x2 fliplr(x2)], [y2-CI2 fliplr(y2+CI2)], [.93, 0.4, .53], 'FaceAlpha',0.5, 'EdgeColor','none')
hold off
ylabel('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'})
yticks([1.450 1.475 1.500 1.525 1.550 1.575 1.600 1.625 1.650 1.675 1.700 1.725 1.750
])
yticklabels({'1.450' '1.475' '1.500' '1.525' '1.550' '1.575' '1.600' '1.625' '1.650' '1.675' '1.700' '1.725' '1.750'
})
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!