Matlab箱线图分组叠加折线图

您所在的位置:网站首页 unit2adifferentschool教案 Matlab箱线图分组叠加折线图

Matlab箱线图分组叠加折线图

2024-07-14 19:44:19| 来源: 网络整理| 查看: 265

%分组group箱线图和折线图的合并版本

%% clear data

%% edge color

edgecolor1=[0.8,0.8,0.8]; % white color:[1,1,1],如果设置成了白色就没有箱子线图边框

edgecolor2=[0.8,0.8,0.8]; % white color

edgecolor3=[0.8,0.8,0.8]; % white color

position_1 = [0.8:1:4.8]; % define position for first group boxplot

position_2 = [1.0:1:5.0]; % define position for second group boxplot

position_3 = [1.2:1:5.2]; % define position for second group boxplot

%分别农村箱线图和对应平均值和中位数的折线图,注意boxplot当有横坐标还想设置位置时用position

figure(2)

box_1 = boxplot(CALCULATE_data_nc,t_nc,'positions',position_1,'colors', ...

edgecolor1,'width',0.1,'notch','on','symbol','');

hold on;

p1=plot(position_1,mean_nc,'o',position_1,med_nc,'-')

p1(2).LineWidth = 1;%set median linewidth to 1

p1(2).Color = [.6,.1,.3];p1(1).Color = [.6,.1,.3];%set color of both mean and media

hold on

box_2 = boxplot(CALCULATE_data_CZ,t_CZ,'positions',position_2,'colors', ...

edgecolor2,'width',0.1,'notch','on','symbol','');

hold on;

p2=plot(position_2,mean_CZ,'o',position_2,med_CZ,'-')

p2(2).LineWidth = 1;%set median linewidth to 1

p2(2).Color = [.5,.5,.5];p2(1).Color = [.5,.5,.5];%set color

hold on

box_3 = boxplot(CALCULATE_data_QT,t_QT,'positions',position_3,'colors', ...

edgecolor3,'width',0.1,'notch','on','symbol','');

p3=plot(position_3,mean_QT,'o',position_3,med_QT,'-')

p3(2).LineWidth = 1;%set median linewidth to 1

p3(2).Color = [.6,.2,.6];p3(1).Color = [.6,.2,.6];%set color

ylim([-10, 300]);%设置y坐标轴

set(gca,'XTick', [1 2 3 4 5]);%设置x坐标轴每一个时间点的位置和间隔

%如果要分组填写颜色:

fillcolor1=[0 0 0]/255; % fillcolors = rand(24, 3);

fillcolor2=[190 190 190]/255;

fillcolor3=[220 220 220]/255;

fillcolors=[repmat(fillcolor1,5,1);repmat(fillcolor2,5,1);repmat(fillcolor3,5,1)];

boxobj = findobj(gca,'Tag','Box');

a=length(boxobj)

for j=1:a

patch(get(boxobj(j),'XData'),get(boxobj(j),'YData'),fillcolors(j,:),'FaceAlpha',0.1);

end

%%% 每一个legend之间都要加上该语句,即可建立新的legend,而不会覆盖之前的

h1=legend(p2,['mean_CZ','med_CZ'],{"Mean DNB", "Median DNB"});

% 设置h1的位置和大小

set(h1,'Location','North','units','normalized','FontName','Times New Roman');

ylabel('Radiance(nW·cm-2·sr-1','FontName','Times New Roman')

xlabel('Date','FontName','Times New Roman')

title('NTL Changes in Different Regions(Median)','FontName','Times New Roman','FontWeight','bold','FontSize',12);

%set(box_1,'LineWidth',1.5);%1设置每个框的粗细

%set(box_2,'LineWidth',1.5);

%set(box_3,'LineWidth',1.5);

%text 函数的前两个输入参数指定位置。第三个参数指定了文本。

txt = 'Urban built-up areas';

t= text(5.2,180,txt,'FontName','Times New Roman','FontWeight','bold')

t.Rotation = 90

txt = 'Rural settlements';

t= text(5.0,23,txt,'FontName','Times New Roman','FontWeight','bold')

t.Rotation = 90

txt = 'Vegetation-dominatied areas';

t= text(5.4,3,txt,'FontName','Times New Roman','FontWeight','bold')

t.Rotation = 90



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭