Reputation: 4373
I'm plotting a confusion matrix as the following with colorbar in it:
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:
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 =)
Upvotes: 5
Views: 4648
Reputation: 26069
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))
Upvotes: 10