how do i use multiple colormaps and ranges in automated subplots

2 Ansichten (letzte 30 Tage)
bstechel
bstechel am 5 Jan. 2021
Kommentiert: bstechel am 5 Jan. 2021
I have a loop that generates even (aday) and uneven subplots (hday). Even subplots have colormap 'winter' and uneven subplots have colormap 'summer'.
Certain pixels represent land and have a fixed value (-1), these values should be represented in black.
also, the range of the colormaps should be adaptable. I didn't manage to get caxis working on the two different color maps.
cmap1 = winter;
cmap1(1:6,:) = zeros(6,3); %makes 0 values black -> should be adapted to make negative values black
cmap2 = summer;
cmap2(1:6,:) = zeros(6,3); %makes 0 values black -> should be adapted to make negative values black
for k1 = 1:10
%even subplots
im_yr = 2000 + k1 -1;
aday = load(['results\res_arrivals_',num2str(im_yr)]); %load the arrival time image
sbpl = k1 *2; %calculate subplot nr
a{k1}=subplot(5,4,sbpl);
imagesc(aday);
axis off
colormap(a{k1}, cmap1);
%uneven subplots
hday = load(['results\res_harvest_',num2str(im_yr)]); %load the harvest time image
hday = cell2mat(struct2cell(hday));
sbpl = k1*2-1;
h{k1}=subplot(5,4,sbpl);
imagesc(hday);
axis off
colormap(h{k1}, cmap2);
end
  1 Kommentar
bstechel
bstechel am 5 Jan. 2021
This is where I'm at the moment. Values should range between 0 and 365. The current range is somehow automatically implemented.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by