フィルターのクリア

coloring areas under the curves using patch

2 ビュー (過去 30 日間)
franco otaola
franco otaola 2021 年 4 月 15 日
Hello,
Following some comments/guidance to color the area between two curves I finished using the function patch, but when i do it for several graphs, sometimes I have an strange behavior,
for example:
  1. I get some areas that should be colored, without color and when I zoom in the figure with the zoom tool the area automatically colors itself.
  2. I get at the end of some curves a stange line that comes back and goes outside of the area.
see attached picture for the strange behaivor and the script I am using for it is as follows:
plot(time(:,i),GCsignals(:,i))
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
hold on
for j=1:length(peakWindowBegining)
if pos(i,j)~=1
plot(time(pos(i,j),i),GCsignals(pos(i,j),i),'o')
a=(GCsignals(endSignal(i,j))-GCsignals(beginingSignal(i,j)))/(time(endSignal(i,j))-time(beginingSignal(i,j)));
b=GCsignals(beginingSignal(i,j))-a*time(beginingSignal(i,j));
base{i,j}=a*time(beginingSignal(i,j):endSignal(i,j),i)+ b;
plot(time(beginingSignal(i,j):endSignal(i,j),i),base{i,j})
patch([time(beginingSignal(i,j):endSignal(i,j),i) fliplr(time(beginingSignal(i,j):endSignal(i,j),i))], [GCsignals(beginingSignal(i,j):endSignal(i,j),i) fliplr(base{i,j})],'g')
end
I can see that the problem 1. it might be a display issue? and might not be solvable from my side.... but the 2. might be a problem with the fliplr command? or patch itself? i might be doing something wrong.

回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by