how to draw bar plot for histogram values?

I have computed the precision,recall and f measure for the algorithm. I want to draw bar plot for the three values. Precision=1*256,recall=1*256,F-measure=1*256. I am getting figure like this.
But, I want something like this and I have attached the text file
I have written the code
data = [P_1,R_1,f_1,
P_2,R_2,f_2,
P_3,R_3,f_3
P_4,R_4,f_4];
b=bar(data);
set(b(1),'FaceColor','b');
set(b(2),'FaceColor','r');
set(b(3),'FaceColor','y');
grid on;
set(gca,'XTickLabel',{'DEMO1','DEMO2','DEMO3','DEMO4'});
legend('Precision','Recall','F_\beta');

댓글 수: 6

the cyclist
the cyclist 2017년 7월 30일
Can you post your underlying data (P1, etc.), or a small sample that exhibits the problem?
Ad
Ad 2017년 7월 30일
I am attaching the text file.
the cyclist
the cyclist 2017년 7월 30일
It would be a lot more convenient if you uploaded a MAT file with the variables already uploaded and formatted.
the cyclist
the cyclist 2017년 7월 30일
Here you go.
Can you do the same for your other variables?
the cyclist
the cyclist 2017년 7월 30일
I stupidly overlooked a very basic problem with what you are doing.
Your data matrix has 12*256 = 3,072 values. But the bar chart you want only plots 18 values.
What is it that you actually want to plot?
Ad
Ad 2017년 7월 31일
Thank you so much for pointing out the mistake. I got it. I want to calculate the mean and then plot it.once again thank you

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

답변 (1개)

the cyclist
the cyclist 2017년 7월 29일

0 개 추천

My guess is that you are grouping the wrong dimension. Try using the transpose
bar(data')

댓글 수: 1

Ad
Ad 2017년 7월 30일
Thank you for your answer. But it is not working

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

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

Ad
2017년 7월 29일

댓글:

Ad
2017년 7월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by