[Reproduced] Three tools to draw errorbar diagrams

Original link: https://www.cnblogs.com/mat-wu/p/7966855.html
Error bars are graphical representations of data variability and are used in graphs to indicate errors or uncertainties in reported measurements. They give a general concept of measurement accuracy, or conversely, how far away from the reported value, what the true (error-free) value might be. Error bars usually represent a standard deviation of uncertainty, a standard error, or a specific confidence interval (for example, 95% interval).

If various other conditions are true, error bars can be used to compare the two quantities. This can determine whether the difference is statistically significant. Error bars can also indicate the fitness of a given function, that is, how well the function describes the data. Scientific papers in experimental science are expected to contain error bars in all graphs. It has also been shown that the error bar can be used as a direct manipulation interface for controlling the probability algorithm for approximate calculations. Error bars can also be expressed by plus or minus signs (±) plus the upper limit of the error and minus the lower limit of the error.

In paper writing, data graphs are often used to represent the characteristics of a set of data, and visual graphs can clearly and intuitively compare the differences between data. The mean and standard deviation of the data are represented in the same graph, which can be used to compare the differences in data distribution. Errorbar is such a graph.

1. Excel drawing

(1) First, select a set of data, including the mean and standard deviation.

(2) Select the data, then insert-all charts-scatter chart in the menu bar, and click OK.

Insert picture description here
(3) Select the + sign in the upper right corner of the chart, select the error bar, and select the error data.
Insert picture description here
4) Click more options to set the format of error bars. Such as positive and negative deviations, end styles and custom error data, the upper and lower limits can be different.
Insert picture description here
(5) The result is shown in the figure
Insert picture description here

2. Origin drawing

(1) Select the data, in the menu bar plot——symbol——Y Error
Insert picture description here
(2) The figure is shown below. You can set the line style, mark style, etc.
Insert picture description here

3. Matlab drawing

(1) Matlab drawing function is errorbar, and the function call methods are as follows
Insert picture description here
(2) Several errorbar graphics drawn by matlab function
Insert picture description here
(3) Code examples

%errorbar函数实例
figure;
subplot(2,2,1);
%横轴
x = 1:10:100;
%均值
y = [20 30 45 40 60 65 80 75 95 90];
%标准差
err = 8*ones(size(y));
%线型,颜色,线宽,标记大小
errorbar(x,y,err,'-*b','LineWidth',1','MarkerSize',8) 
xlabel('月份');ylabel('销量/千件');
%设置坐标轴字体大小粗细,字体样式以及横纵轴范围
set(gca,'fontsize',10,'fontweight','bold','FontName','Times New Roman','XLim',[0,120],'YLim',[0,120]);
  
subplot(2,2,2);
x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
err1 = 10*ones(size(y));
err2 = 10*rand(size(y));
errorbar(x,y,err1,err2,'*b','LineWidth',1','MarkerSize',8) 
xlabel('月份');ylabel('销量/千件');
title('No line','fontsize',10,'fontweight','bold');
%设置坐标轴字体大小粗细,字体样式以及横纵轴范围
set(gca,'fontsize',10,'fontweight','bold','FontName','Times New Roman','XLim',[0,120],'YLim',[0,120]);
 
subplot(2,2,3)
Average1=[12,11,7,7,6,5];
Variance1=[0.5,0.4,0.3,1,0.3,0.5];     %A地的数据
Average2=[10,8,5,4,3,3];
Variance2=[0.4,0.3,0.4,0.6,0.3,0.5];    %B地的数据
Time=1:1:6;
errorbar(Time,Average1,Variance1,'r-o')    %A地误差棒图,用红色线表示
hold on
errorbar(Time,Average2,Variance2,'b-s')    %B地误差棒图,用蓝色线表示
xlabel('月份');ylabel('销量/千件');
 
subplot(2,2,4);
Average2=[120,110,70,70,60,50];
Variance2=[15,14,8,10,9,9];     %A地的数据
Average3=[100,80,50,40,30,30];
Variance3=[14,8.3,9.4,10.6,13,15];    %B地的数据
Time=1:1:6;
errorbar(Time,Average2,Variance2,'ro')    %A地误差棒图,用红色线表示
hold on
errorbar(Time,Average3,Variance3,'bs','MarkerSize',10,...
    'MarkerEdgeColor','red','MarkerFaceColor','red')    %B地误差棒图,用蓝色线表示
xlabel('月份');ylabel('销量/千件');
set(gca,'fontsize',10,'fontweight','bold','FontName','Times New Roman','XLim',[0,8],'YLim',[0,140]);
grid on;

Guess you like

Origin blog.csdn.net/zou_albert/article/details/114852843