필터 지우기
필터 지우기

Trying to shade the area between upper and lower confidence bands on Kaplan Meier Curve

조회 수: 3 (최근 30일)
Hi everyone,
This is my first time posting here. I am a total beginner. I am trying to shade the area between upper and lower confidence bands on kaplan meier curve, without any success. See below the code I used to plot the curve and confidence bands. I have searched the forums and tried several variations of patch and fill functions that I saw in replies, but nothing has worked for me. I have attached a sample of the data I am trying to plot. I shall be highly grateful for any guidance in this regard. Thanks in advance
plot(timeDays,probability,'b', 'LineWidth', 2);
xlabel('Time');
ylabel('Survival probability');
title('Kaplan-Meier curve with confidence bands');
hold on
%% upper and lower confidence bands
plot(timeDays,lower, 'b');
plot(timeDays,upper,'b');
hold off

채택된 답변

David Hill
David Hill 2023년 9월 18일
A=readmatrix('data table.csv','Range','A13:D408');
timeDays=A(:,1)';probability=A(:,2)';Lower=A(:,3)';Upper=A(:,4)';
plot(timeDays,probability,'r');
hold on;
patch([timeDays, fliplr(timeDays)], [Lower, fliplr(Upper)], 'g','FaceAlpha',0.2);
  댓글 수: 1
Muhammad
Muhammad 2023년 9월 19일
Thankyou so much! Your code helped me realise the issue I was running into! Really appreciate the help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by