how to make confusion matrix has class names

10 views (last 30 days)
Jerry
Jerry on 14 Mar 2012
Commented: Vikas on 10 Feb 2014
hi all; is there any way to show class names on the confusionmatrix which is plotted by plotconfusion? I found that the set(h,'XTickLabel') does not work.
Thanks a lot regards

Answers (1)

Antje
Antje on 23 May 2013
Hi!
For me this example works fine:
a=[1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 0];
b=[1 0 1 1 0 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0];
figure(1)
plotconfusion(a,b)
xlabel('string')
set(gca,'xticklabel',{'class1' 'class2' ''})
Hope this helps!
  2 Comments
Vikas
Vikas on 10 Feb 2014
Hi,
If a=[1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 0]; b=[1 0 1 1 0 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0]; a=[1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0]; b=[1 0 1 1 0 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0]; and using plotconfusion(a,b,'name1',c,d,'name2') then is there way to change the name of class in both the plots?
Vikas
Vikas on 10 Feb 2014
Hi,
If a=[1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 0]; b=[1 0 1 1 0 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0]; c=[1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0]; d=[1 0 1 1 0 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0]; and using plotconfusion(a,b,'name1',c,d,'name2') then is there way to change the name of class in both the plots?

Sign in to comment.

Categories

Find more on Numeric Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!