필터 지우기
필터 지우기

How can I change color and font size in plotconfusion figures?

조회 수: 15 (최근 30일)
Antje
Antje 2013년 5월 23일
댓글: Abdullah Al-Maliki 2020년 11월 27일
Hi!
I want to change the color of the fields of the confusion matrix and also to change the font size of the entries in the fields. I know I can do it in the plot editor, but I prefer to do it automatically perhaps with set and get? I couldn't find anything in google on that topic.
Thanks for your help!
Just a little example:
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)

채택된 답변

Antje
Antje 2013년 5월 23일
I got it! :)
For those who are interested in the solution:
%defining my colors
f1=[0 0 139]/255;
f4=[50 205 50]/255;
f9=[236 0 0]/255;
f14=[85 26 139]/255;
%example
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)
%fontsize
set(findobj(gca,'type','text'),'fontsize',20)
%colors
set(findobj(gca,'color',[0,102,0]./255),'color',f4)
set(findobj(gca,'color',[102,0,0]./255),'color',f9)
set(findobj(gcf,'facecolor',[120,230,180]./255),'facecolor',f4)
set(findobj(gcf,'facecolor',[230,140,140]./255),'facecolor',f9)
set(findobj(gcf,'facecolor',[0.5,0.5,0.5]),'facecolor',f1)
set(findobj(gcf,'facecolor',[120,150,230]./255),'facecolor',f14)
Not very elegant, but it works!

추가 답변 (1개)

Shivang Patel
Shivang Patel 2015년 5월 4일
My confusion matrix size is 19x19.. so, Is there any convenient way to display clearly...because u know when 19x19's confusionMatrix plot it's a overlap some value...n everything hochpoch !!!
Thanks for Advance...
  댓글 수: 4
Walter Roberson
Walter Roberson 2017년 8월 8일
No, there is no convenient way. You would have to do the plotconfusion() and then find the created objects and move them into a large container that you had created scrollbars for.
Abdullah Al-Maliki
Abdullah Al-Maliki 2020년 11월 27일
Use the command from the accepted answer above just change the font size from 20 to 5, Iused it and it helped to better show a 26 class confusion matrix.
set(findobj(gca,'type','text'),'fontsize',5)
PS I know this is an old thread but I'm posting this reply to help whoever might needed!

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

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by