I have two contour plots and I want to be able to fill from one contour in one image to the same height contour in the other.
In the plot you can see two lines of each color - these are the lines I want to fill between, with the same color as the lines (though preferably translucent). The code for these are as follows
test = repmat(repelem(0:6,2),10,1);
test1 = test(:,2:end-1);
test2 = test(:,1:end-2);
contour(test1,1:5);
hold on;
contour(test2,1:5);
I did think that maybe I could create another image that has the desired height at each bin and do some kind of contourf
, but that could be a problem if in future the lines cross over, which they may well do. In that case, I'd like the area they cross to be a combination of the colors that are crossing over.
Have you try using ```fill``?
% test values
col = 'g';
x1=[6 6 6];y1=[1 5 10]; x2= [7 7 7];
x2 = [x1, fliplr(x2)];
inBetween = [y1, fliplr(y1)];
fill(x2, inBetween, col);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With