作者amateuruser (( ・ω・`))
看板MATLAB
标题[讨论] 多条曲线点 errorbar询问
时间Mon Dec 3 15:06:24 2018
如题
先附上程式码
clear;
x1 = [1,2,3];
y1= [1.1,1.2,1.5];
x2 = [1,2,3];
y2= [1.41,1.42,1.45];
err1 = [0.016,0.05,0.10];
err2 = [0.026,0.053,0.069];
errorbar(x1,y1,err1,'-o');
errorbar(x2,y2,err2,'-diamond');
grid % grid on plot
axis([1 3 1 2.5]); % axis: x between 1 and 40, y between 0 to 10
set(gca, 'xtick', [1 2 3])
set(gca,'xticklabel', {'condition1','condition2','condition3'})% x axis tick value
set(gca,'ytick', 0:1:4); % y axis tick value
set(gca, 'ytick', [1,1.5,2,2.5]);
set(gca,'FontSize',15);
title('pH measurement Design 1 & Design 2')
xlabel('Conditions', 'FontSize', 15);
ylabel('Output, 'FontSize', 15);
想问一下版上的大大
为什麽当单一组曲线 一组errorbar 可以绘制
但是同时两组errorbar放在一块却只出现一条线呢?
再者 legend要怎麽弄才会对到图上当两条线呢?
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 27.242.4.86
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MATLAB/M.1543820789.A.136.html
1F:→ book5601: 查查 hold on 应该有用 12/03 19:40
2F:→ sblk: her01 = errorbar(x1,y1,err1,'-o'); hold on; 12/03 21:53
3F:→ sblk: her02 = errorbar(x2,y2,err2,'-diamond'); 12/03 21:53
4F:→ sblk: legend([her01,her02],'Group1','Group2') 12/03 21:53
5F:→ sblk: 查查legend里的例子 12/03 21:57