[讨论] 多条曲线点 errorbar询问

楼主: amateuruser (U文心得大师)   2018-12-03 15:06:24
如题
先附上程式码
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要怎么弄才会对到图上当两条线呢?
谢谢
作者: book5601 (苍澜野兽)   2018-12-03 19:40:00
查查 hold on 应该有用
作者: sblk (Time)   2018-12-03 21:53:00
her01 = errorbar(x1,y1,err1,'-o'); hold on;her02 = errorbar(x2,y2,err2,'-diamond');legend([her01,her02],'Group1','Group2')查查legend里的例子

Links booklink

Contact Us: admin [ a t ] ucptt.com