coloring areas under the curves using patch
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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:
- 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.
- 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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Polygons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!