colorbar graph exceeding matrix values
So I’m plotting a 4D matrix, called Ft, that ranges from 0-1, but when I graph it and add a colorbar, it’s showing 0-2 for physical states 4-15, and (-1)-1for physical state 1-3
physical states 1-3 are 0 for every timestep in the matrix Ft, so that first graph makes sense. Why does the colorbar range change for the other graphs?
Here’s the code for the graphs. Let me know if more code is needed to create the actual Ft matrix. [[ my entire code would be needed in order to create this matrix ]]
%the setup of Ft is Ft(state,est of patch1,est of patch2,timestep)
B = permute(Ft,[2 3 1 4]);
for state= 1:15
figure(state)
sgtitle([‘physical state = ‘ num2str(state)])
time = 1;
subplot(4,5,time)
imagesc(B(:,:,state,time))
title([‘timestep : ‘ num2str(time)])
xlabel(‘est. of patch 2 quality’);
ylabel(‘est. of patch 1 quality’);
set(gca,’ydir’,’normal’)
for time = 2:19
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
for time = 20
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
colormap hot
colorbar
hold on
end
end
endSo I’m plotting a 4D matrix, called Ft, that ranges from 0-1, but when I graph it and add a colorbar, it’s showing 0-2 for physical states 4-15, and (-1)-1for physical state 1-3
physical states 1-3 are 0 for every timestep in the matrix Ft, so that first graph makes sense. Why does the colorbar range change for the other graphs?
Here’s the code for the graphs. Let me know if more code is needed to create the actual Ft matrix. [[ my entire code would be needed in order to create this matrix ]]
%the setup of Ft is Ft(state,est of patch1,est of patch2,timestep)
B = permute(Ft,[2 3 1 4]);
for state= 1:15
figure(state)
sgtitle([‘physical state = ‘ num2str(state)])
time = 1;
subplot(4,5,time)
imagesc(B(:,:,state,time))
title([‘timestep : ‘ num2str(time)])
xlabel(‘est. of patch 2 quality’);
ylabel(‘est. of patch 1 quality’);
set(gca,’ydir’,’normal’)
for time = 2:19
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
for time = 20
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
colormap hot
colorbar
hold on
end
end
end So I’m plotting a 4D matrix, called Ft, that ranges from 0-1, but when I graph it and add a colorbar, it’s showing 0-2 for physical states 4-15, and (-1)-1for physical state 1-3
physical states 1-3 are 0 for every timestep in the matrix Ft, so that first graph makes sense. Why does the colorbar range change for the other graphs?
Here’s the code for the graphs. Let me know if more code is needed to create the actual Ft matrix. [[ my entire code would be needed in order to create this matrix ]]
%the setup of Ft is Ft(state,est of patch1,est of patch2,timestep)
B = permute(Ft,[2 3 1 4]);
for state= 1:15
figure(state)
sgtitle([‘physical state = ‘ num2str(state)])
time = 1;
subplot(4,5,time)
imagesc(B(:,:,state,time))
title([‘timestep : ‘ num2str(time)])
xlabel(‘est. of patch 2 quality’);
ylabel(‘est. of patch 1 quality’);
set(gca,’ydir’,’normal’)
for time = 2:19
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
for time = 20
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
colormap hot
colorbar
hold on
end
end
end graph, colorbar MATLAB Answers — New Questions