Hi. I have a 60×60 matrix "count" (containing values between 0 and >1000) that I would like to make an imagesc from, using a logarithmic scale, by first creating a non logarithmic one with a logarithmic colorbar and then creating a logarithmic one and copying the logarithmic colorbar from the first one (so the colors in the image and the colorbar match the values).
Here is my attempt so far
figure(1) %first figure
count2=count+1; %add 1, because log10(0) not defined
imagesc(count2') %image with real values
cbr = colorbar('Yscale', 'log'); %logarithmic colorbar
figure(2) %second figure
imagesc(log10(count2')) %logarithmic image
set(gca,'YDir','normal')a = get(1,'children'); %extract colorbar from first figure
copyobj(a(1),2); %copy to second figure
close Figure 1
The problem is that the colours from the image and the colorbar match, but the colorbar covers part of the figure. I would like the second figure to resize when copying the colorbar. Also, since I had to add 1 to count for the logarithmic scaling, I would like to replace the YTick 10^0 at the bottom of the colorbar with 0. For the others YTicks it doesn't matter if the accuracy is +- 1.
Thanks for any help!
Best Answer