Why doesn't the patch command fill homogeneously the region between two arrays?
이전 댓글 표시
I've done a fitting with lscov, calculated the confidence intervals and tried to plot the resulting line and use the patch command to paint the region limiting the confidence intervals of the fitting. Translating, I have three arrays, one is the fitting, and I want to color the region between the other two, like shown in the image (A). What I obtain is the image (B), not only in the figure environment, but also in the generated pdf.
The image looks better if I define a thinner axis with around 6000 points, but then the pdf takes ages to be generated (it weights >100MB) and sometimes the figure environment doesn't even load.
What could be happening here?

Example code used to generate (B):
x = 1:100:6000 ;
A = [1000 1500 3000 5000].' ;
B = [5 7 12 17].' ;
C = [2 3 2 1].' ;
[f,s] = lscov(A,B,1./C.^2) ;
figure,errorbar(A,B,C), hold on,
plot(x,x*f,'-r','LineWidth',1), hold on,
patch([x; flipud(x)], [x*(f-s); flipud(x*(f+s))],[1.0 0.0 0.0], ...
'EdgeColor',[1.0 0.0 0.0],'facealpha',0.3,'edgealpha',0.05), hold on,
xlim([0 6000]),
ylim([0 20]),
댓글 수: 2
Rik
2022년 7월 1일
The image your code produces does not look like the B image you posted. It is not clear to me how you would get that with this code.
Federico Geser
2022년 7월 1일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

