I have a 420*940*12 matrix (the value of each grid ranges from 0-100) and I want to plot data only inside polygon S
, with lat
(420*1) and lon
(940*1) as grid references.
We can create a single plot of only points without its values (0-100):
S = shaperead(polygon);
N = length(S);
[X,Y] = meshgrid(lon,lat);
data= test;
for k = 1:N
idx = insidepoly(X(:),Y(:),S(k).X,S(k).Y);
hold on
plot(X(idx), Y(idx), 'r*')
end
But this figure is only showing the points not its values (0-100) And the output is something like this:
But I have to plot multiple data together, lets say 12 months of a year so, how can I make 12 plots together according to values (0-100) as in the below figure?
one possible solution is to use montage, see here:
img = imread('peppers.png');
img = repmat(img,1,1,1,6);
montage(img)