2D Classification Matrix Display

I have a 304 x 3 classification matrix M where each row represents [xvalue yvalue class]
and where class is a value of either 1 or 2.
I basically want to generate some kind of heat map like this: http://www.mathworks.com/help/techdoc/ref/plottype-imagesc.gif
where the colors of each point correspond to the value of the class. I've been told to the imagesc function and have looked this up. imagesc seems to convert some matrix into an image so i'm assuming that if i have the graph image and turn that into a matrix, i could produce a diagram similar to the one above?
Any help is greatly appreciated

답변 (2개)

Andrew Newell
Andrew Newell 2011년 3월 29일

0 개 추천

You could do this:
I = M(:,3)>1.5;
plot(M(I,1),M(I,2),'b.')
hold on
plot(M(~I,1),M(~I,2),'r.')
Note that I am using the criterion less than/greater than 1.5 so rounding errors don't cause problems.

댓글 수: 2

Ameer
Ameer 2011년 3월 29일
Thanks for the reply Andrew
I tried it out and it gave me a plot where all the red and blue points were connected together. This is fine but what I really need is to take that plot and produce some sort of heat map diagram which looks a little something like this.
http://www.mathworks.com/help/techdoc/ref/plottype-imagesc.gif
I know I'm supposed to use imagesc function but supply the matrix of the image to it but I don't know how to do this.
Walter Roberson
Walter Roberson 2011년 3월 29일
Are you sure you included the '.' in your plot specification, Ameer? The '.' part of the 'b.' and 'r.' tells it to use markers _at_ the data locations but not to draw connecting lines.

댓글을 달려면 로그인하십시오.

mumtaz
mumtaz 2013년 12월 1일

0 개 추천

how could i convert an .tiff or .gif images into the matrix a matlab code for it.?

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

태그

질문:

2011년 3월 29일

답변:

2013년 12월 1일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by