加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

MATLAB--画多组boxplot

(2020-09-27 20:33:17)
分类: MATLAB
用matlab画两种数据的箱线图对比
该方法其本质为画两张共享横轴的boxplot
MATLAB--画多组boxplot


% code
position_O = 1:1:12; 
% Define position for 12 Month_O boxplots 
box_O = boxplot(pbl_monthly_cs(:,1:12),'colors','b','positions',position_O,'width',0.18);set(gca,'ylim',[0 2000]);
set(gca,'XTickLabel',{'Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec'})  % 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
position_S = 1.3:1:12.3;  % Define position for 12 Month_S boxplots 
box_S = boxplot(pbl_monthly_cs(:,13:24),'colors','r','positions',position_S,'width',0.18);  
ylabel('PBLH (m)','Fontname','Times New Roman','FontWeight','bold','FontSize',font)
set(gca,'XTick', [1 2 3 4 5 6 7 8 9 10 11 12]);set(gca,'ylim',[0 2000]);
set(gca,'XTickLabel',{'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'})
set(gca,'FontSize',font,'FontName','Times New Roman','FontWeight','bold');
set(gca,'TickDir','out');
% set(gca,'ygrid','on');
set(gca,'FontSize',font,'FontName','Times New Roman','FontWeight','bold')
text(1,1800,'CS-20:00','FontSize',font,'FontName','Times New Roman','FontWeight','bold')

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有