Plot scatter plot as shade

조회 수: 4 (최근 30일)
Shahriar Mahmud
Shahriar Mahmud 2021년 10월 21일
댓글: Star Strider 2021년 11월 17일
Hi,
I have the attached data (conc.mat) where each row corresponds to y axis value for a given x value(t=[0;30;60;120;300;600;900]). I am doing uncertainty analysis here. I also have the actual data set (single y value for single x value), which should construct a firm plot in the same graph. So, in summary, I should have a firm line from the actual data set which I have not shared here, but also I should be able to generate a shaded area from the attached data. The final product should be something like the attached file (Capture.JPG). Please suggest some solutions. Thanks.

채택된 답변

Star Strider
Star Strider 2021년 10월 22일
Try this —
LD = load('conc.mat');
conc = LD.conc;
t=[0;30;60;120;300;600;900];
figure
plot(t, conc)
hold on
shadeWidth = 0.01;
patch([t; flipud(t)], [min(conc,[],2)-shadeWidth; flipud(max(conc,[],2))+shadeWidth], [1 1 1]*0.5, 'FaceAlpha',0.25, 'EdgeColor','none')
hold off
Experiment to get different results.
.
  댓글 수: 12
Shahriar Mahmud
Shahriar Mahmud 2021년 11월 17일
Thanks again.
It looks ok to me for the time being.
Please see attached. As you can see the shaded portions created by the patch function (See code above you suggested) needs to be smoothened as well. Any suggestions?
Star Strider
Star Strider 2021년 11월 17일
As always, my pleasure!
.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by