-1

I'm trying to make a confusion matrix for some classification problem. So far, I've managed to make a 10 by 10 matrix that stores the accuracy of my estimation for classification problem.

Now I want to make a 10 by 10 square image(?) that has a darker color when the number in that location of the matrix has a higher number. (Ranges from 0 to 100)

I've never done graphics with Matlab before. Any help would be greatly appreciated.

Thanks.

WannabeArchitect
  • 1,058
  • 2
  • 11
  • 22
  • Sorry, Stack Overflow is not a free code writing service. Please read up on [ask] and [edit] the question accordingly. First and foremost is that you *should do your own research and present that here*. So list what you already found out how to do this, and, if you already have any (non-working) code, add that as well, this is called a [mcve]. You might be interested in [which topics one can ask about on SO](https://stackoverflow.com/help/on-topic) as well. – Adriaan Jun 14 '18 at 08:26
  • @Adriaan I've looked into your links, and I don't see to which "off-topic" category this question falls into. This problem does not ask to be solved from scratch, and the guy did some effort. – Daniel Heilper Jun 14 '18 at 09:10
  • @DanielHeilper the problem here is that this is a question in the category *I have solved part A). These are the requirements for B)*. Without research for part B), the question essentially boils down to a "please write this for me", regardless of what's written for the rest. I can ask a question about some conjugate gradient scheme I completely wrote, but if my question boils down to "how to visualise it", and the question doesn't reflect any research on my part for the visualisation, it's still unresearched and probably broad. – Adriaan Jun 14 '18 at 09:18
  • @Adriaan clarified and understood – Daniel Heilper Jun 14 '18 at 11:32

1 Answers1

2

I would use image. For example:

img = 100*rand(4,4);  % Your image
img = img./100*64;  % The `image` function works on scale from 0->64
image(img); % or `image(img')` depending on how you want the axis
colormap('grey'); % For grey scale images
axis equal;       % For square pixels

Or for inverted colours you can change the one line to:

img = 64-img./100*64;
Hein Wessels
  • 937
  • 5
  • 15