shading plots between one standard deviation

3 ビュー (過去 30 日間)
SWARNENDU PAL
SWARNENDU PAL 2020 年 12 月 14 日
回答済み: Image Analyst 2020 年 12 月 17 日
I am trying to shade the region between two standard deviation. So i write code like the below :
plot(datenum(monthly_mean.mytime),monthly_mean.PM_2_5+15.6538,datenum(monthly_mean.mytime),monthly_mean.PM_2_5-15.6538)
datetick('x', 'mmm','keeplimits')
xlim([737791 737943])
date_std = [datenum(monthly_mean.mytime),fliplr(datenum(monthly_mean.mytime))];
inbetween = [monthly_mean.PM_2_5-15.6538,fliplr(monthly_mean.PM_2_5+15.6538)];
fill(date_std,inbetween,'g')
hold on
plot(datenum(monthly_mean.mytime),monthly_mean.PM_2_5)
datetick('x', 'mmm','keeplimits')
xlim([737791 737943])
I have used also function 'patch' for doing that part. I have uploaded the figure, so i want to shade the region between the top and bottom curve, but somehow a straightline appears and fill those parts(in the figure). How to overcome this problem? I have taken those parts also from mathworks. Please guide me. Thank you
  2 件のコメント
VBBV
VBBV 2020 年 12 月 14 日
Can you attach the data or coorindates if plot shown in fig ?
SWARNENDU PAL
SWARNENDU PAL 2020 年 12 月 15 日
I have submitted data. please guide me. Thank you.

サインインしてコメントする。

回答 (2 件)

KSSV
KSSV 2020 年 12 月 15 日
If (x1,y1) and (x1,y2) are tow data, with x1 increasing montonically. I assume they are column arrays. I assumed both of them are of same size (offcourse they x1 common). To fill color beteen these two curves. Follow:
x = [x1 ; flipud(x1)] ;
y = [y1 ; flipud(y2)] ;
patch(x,y,'r')
You need to arrange the data such that, the data form a closed region.
  1 件のコメント
SWARNENDU PAL
SWARNENDU PAL 2020 年 12 月 17 日
it did not worked sir.

サインインしてコメントする。


Image Analyst
Image Analyst 2020 年 12 月 17 日

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by