matlab绘图函数

matlab绘图函数(3):3D绘图  

使用Matlab绘制三维图的几种方法

reshape(a,1,9) 与 repmat (a,1,2) 的比较

Matlab如何画箱线图群组(转自:http://blog.sina.com.cn/s/blog_46acd6f50101a6wj.html)

 
Matlab如何画箱线图群组
使用Matlab如何画出上面的箱线图群组?
 
示例:

data = rand(20,24)

month = repmat({'jan' 'feb' 'mar' 'apr' 'may' 'jun' 'jul' 'aug' 'sep' 'oct' 'nov' 'dec'},1,2);

simobs = [repmat({'sim'},1,12),repmat({'obs'},1,12)];

boxplot(data,{month,simobs},'colors',repmat('rb',1,12),'factorgap',[5 2],'labelverbosity','minor');

另一种方法是利用不同坐标使用hold on在同一幅图上画箱线图

% Boxplot for the observed temperature from January to December

Temp_O = [Jan_O, Feb_O, Mar_O, Apr_O, May_O, Jun_O, Jul_O, Aug_O, Sep_O, Oct_O, Nov_O, Dec_O];  % Jan_O 为列向量

position_O = 1:1:12; 

% Define position for 12 Month_O boxplots 

box_O = boxplot(Temp_O,'colors','b','positions',position_O,'width',0.18);

set(gca,'XTickLabel',{' '})  % Erase xlabels  

hold on  % Keep the Month_O boxplots on figure overlap the Month_S boxplots  

% Boxplot for the simulated temperature from January to December

Temp_S = [Jan_S, Feb_S, Mar_S, Apr_S, May_S, Jun_S, Jul_S, Aug_S, Sep_S, Oct_S, Nov_S, Dec_S];

position_S = 1.3:1:12.3;  % Define position for 12 Month_S boxplots 

box_S = boxplot(Temp_S,'colors','r','positions',position_S,'width',0.18);  

hold off   % Insert texts and labels 

Matlab如何画箱线图群组

以上两种方法均可画多组的箱线图

上下四分位数(Q3和Q1), 四分位距IQR=Q3-Q1。异常值被定义为小于Q1-1.5IQR或大于Q3+1.5IQR的值。

posted @ 2017-10-09 14:39  Hand&Head  阅读(650)  评论(0)    收藏  举报