matlab柱状图添加横坐标,matlab中画折线/柱状图(横坐标为字符串、及其它注意事项)...

该博客介绍了如何在MATLAB中创建横坐标为字符串的折线图和柱状图,包括设置自定义横坐标标签、添加箭头、调整颜色和显示EER(错误接受率)。同时还提供了详细的代码示例,展示了如何添加注释和图例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

%画折线图

x = [1 2 3 4 5];

y = [2.27 12.60 17.20 14.33 16.03];

hold on;

axis([0 6 0 20]);

plot(x,y,'-*k','LineWidth',2);

%set(gcf, 'color', 'w');

%change the xlabel;

set(gca,'xticklabel',{'','Neutral','Happy','Sad','Anxious','Angry'});

text(1,2.3,'24.35');

text(2,24.2,'23.88');

text(3,24,'23.60');

text(4,24,'23.67');

text(5,25,'24.56');

xlabel('Speech probability','fontsize',15);

ylabel('EER(%)', 'fontsize',15);

% ??

%使图像带箭头

annotation('arrow',[0.132 0.132],[0.8 1]);

annotation('arrow',[0.8 1],[0.108 0.108]);

%set(gca,'box','off','tick',[]);

%画柱状图

%row is for each test

x=[

(14.61-13.36)/14.61 (14.61-12.71)/14.61;

(20.16-17.05)/20.16 (20.16-16.55)/20.16;

(17.30-16.30)/17.30 (17.30-15.65)/17.30;

(18.55-16.55)/18.55 (18.55-16.05)/18.55;

]

%hold on;

b = bar(x);

ch = get(b,'children');

%set color:

set(b(1),'facecolor',[0.6 0 0]);

set(ch{1},'facecolor',[0.81 0 0]);

set(b(2),'facecolor',[0 0 0.8]);

set(ch{2},'facecolor',[0 0 0.8]);

%set background-color

set(gcf, 'color', 'w');

legend('MLLR', 'CMLLR');

%set x/ylim

xlim([0,5]);

ylim([0,0.3])

%set x-label

lab={'Happy', 'Sad', 'Anxious', 'Angry'};

set(gca,'XTickLabel',lab, 'xTick', 1:numel(lab)) ;

xlabel('emotional speech', 'fontsize',15);

ylabel('EER(%)', 'fontsize',15);

set(gca,'fontsize', 15);

%applyhatch(gcf,'/\+.-');

annotation('arrow',[0.132 0.132],[0.8 1]);

annotation('arrow',[0.8 1],[0.108 0.108]);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值