Question

I'm plotting a confusion matrix as the following with colorbar in it:

enter image description here

What I would like to do now is keep everything exactly the same, but inverse the colors. I have tried the following code (which I read from another post in SOF):

myimage = sum(255 - myimage, 3);

And this gives me:

enter image description here

And this is exactly what I want, with the exception that the values in the colorbar have changed...How can I do the same thing without changing the values in the colorbar?

Thank you for any help =)

Was it helpful?

Solution

why wont you just invert the colormap by flipping up-down (flipud)? For example:

cmap=flipud(colormap(gray));
colormap(cmap);

or in a more compact way:

imagesc(your_image);
colormap(flipud(gray))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top