coloring areas under the curves using patch

4 views (last 30 days)
franco otaola
franco otaola on 15 Apr 2021
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:
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
hold on
for j=1:length(peakWindowBegining)
if pos(i,j)~=1
base{i,j}=a*time(beginingSignal(i,j):endSignal(i,j),i)+ b;
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')
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.

Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by