I want to represent the values of a matrix as an image, adding some text in its margins. To do so, I proceed as follows:
matrix = rand(10); %Suppose this matrix
figure('color','w')
imshow(matrix,[min(matrix(:)), max(matrix(:))])
colormap(gca,jet(256))
colorbar
truesize([400,400])
for i=1:size(matrix,1)
text(-2,i,['long text ' num2str(i)], 'Interpreter', 'none')
h = text(i,0,['column ' num2str(i)], 'Interpreter', 'none');
set(h,'Rotation',90);
end
The original figure is:
I can see the text on the left increasing the figure width (with the mouse for instance):
However, if I increase the figure height as well, the image increases, and I cannot see the full text on the left and on the top at the same time.
I have 2 questions:
- Is there a neater way to represent a matrix including information outside like in this example?
- How could I see the full text properly?

