【MATLAB】全網入門快、免費獲取、持續更新的科研繪圖教程系列2

14 【MATLAB】科研繪圖第十四期表示散點分布的雙柱狀雙Y軸統計圖

%%?表示散點分布的雙柱狀雙Y軸統計圖%%?Made?by?Lwcah?(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除變量
close?all;clear?all;clc;%%?1行1列
%%?一幅圖的時候figureWidth?=?8.5;figureHeight?=?8;調整這兩個參數就可以
%定義整幅圖出現的在電腦屏幕上的位置以及長和寬
%這里有必要解釋一下為什么figureWidth要設置為8.5;
%因詳細解釋需要很長的篇幅,請轉公眾號觀看該天的文章。
figureHandle?=?figure;
figureUnits?=?'centimeters';
figureWidth?=?8.5;
figureHeight?=?6;
set(gcf,?'Units',?figureUnits,?'Position',?[28?20?figureWidth?figureHeight]);
%?注:28代表出圖時圖的左下角相對于整個電腦屏幕的左下角向左偏移28個單位,向上偏移20個單位。
%?可自行調節兩個數字讓圖出在自己屏幕的某個位置%%?定義字體和字號大小
%%?通常的SCI一般Arial字體和10字號通用
fontnamed='華文中宋';%字號名字Arial
ssize=10;%字號大小
%%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(343);%香水玫瑰
C2?=?chinesecolors(150);%靛青
C3?=?chinesecolors(523);%玫瑰灰
%?C4?=?chinesecolors(17);%鵝冠紅%%?數據
x?=?1:30;
y?=?x+rand(1,30)*0.01;%%?表示散點分布的雙柱狀統計圖繪圖
[n1,ctr1]?=?hist(x,20);
[n2,ctr2]?=?hist(y,20);subplot(2,2,2);yyaxis?right
bar(ctr1,-n1,1);h1?=?gca;hold?on;box?on;grid?on;
ylabel('Numbers','fontsize',ssize,'FontName',fontnamed);
alpha(0.1);%調整柱狀圖顏色的透明度yyaxis?left
plot(x,y,'.');axis?on;?h2?=?gca;?hold?on;box?on;grid?on;
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);subplot(2,2,1);
barh(ctr2,-n2,1);axis?off;?h3?=?gca;h1.Position?=?[0.35?0.35?0.50?0.55];
%?h2.Position?=?[0.05?0.35?0.25?0.55];
h3.Position?=?[0.08?0.35?0.15?0.55];%%?修圖的標準格式代碼
%?text(0.5,0.9,'(a)?XXX','fontsize',ssize,'FontName',fontnamed);%,'horiz','center'
%?title('1000');
%?xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
%?ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
%?axis([0?10?0?7]);%XY軸的范圍
%?xticks([1?2?3?4?5?6?7?8?9?10]);%畫格網的時候的小刻度
%?xticklabels({'1','2','3','4','5','6','7','8','9','10'});%加x軸刻度標注
%?yticks([1?2?3?4?5?6]);%畫格網的時候的小刻度
%?yticklabels({'1','2','3','4','5','6'});%加y軸刻度標注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
%?set(gca,'yticklabel',[]);%y軸不顯示
%?set(gca,'xticklabel',[]);%x軸不顯示
grid?on;box?on;hold?on;%%?畫legend
%?hLegend1=legend('A1',?'A2',?'A3','Location',?'northeast','Box',?'off','Orientation','horizontal','fontsize',ssize,'FontName',fontnamed);
%方法一
%?kk=legend('h1');
%?set(kk,'location','NorthEast','Box',?'off','fontsize',ssize,'FontName',fontnamed);%'orientation','horizontal',
%方法二
%?columnlegend(2,{'L1','L2','L3','L4','L5','L6'},'North');%表示一行放三個圖例以及圖例的位置%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1]);
%%?設置完畢后,按照所需分辨率、格式輸出
figW?=?figureWidth;
figH?=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo_scartter_double_bar_plus';
print(figureHandle,[fileout,'.png'],'-r600','-dpng');

15 【MATLAB】科研繪圖第十五期多Y軸圖

%%?多Y軸圖%%?Made?by?Lwcah?(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除環境變量
close?all;clear?all;clc;%%?1行1列-定義整幅圖出現的在電腦屏幕上的位置以及長和寬
figureHandle?=?figure;
figureUnits?=?'centimeters';
figureWidth?=?15;
figureHeight?=?8;
set(gcf,?'Units',?figureUnits,?'Position',?[0?0?figureWidth?figureHeight]);%%?定義字體和字號大小-通常的SCI一般Arial字體和10字號通用
fontnamed='Arial';?%?字號名字Arial
ssize=10;????????????%?字號大小
%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(343);?%?香水玫瑰
C2?=?chinesecolors(150);?%?靛青
C3?=?chinesecolors(523);?%?玫瑰灰
C4?=?chinesecolors(232);?%?粉綠%%
%?handle?=?maxis(number?of?axis,?y-spacing?between?outside?lines)
h?=?myaxisc(4,0.10);?%?第一個參數4是設置軸的數量,第二個參數0.10是設置軸間距
%?Create?some?random?data?for?plotting
t1??=?0:0.1:5;
t2??=?0:1:5;
y11?=?sin(t1);
y21?=?t1.^2-5;
y22?=?15-t2.*2;
y31?=?sqrt(t1).*2+97;
y41?=?rand(size(t1))-2;
y42?=?rand(size(t1))+4;p(1)?=?plot(h.p(1),t1,y11,'Color',C1);hold?on;
p(2)?=?plot(h.p(2),t1,y21,'Color',C2,'LineStyle','--','Marker','o');hold?on;
p(3)?=?plot(h.p(2),t2,y22,'Color',C2,'LineStyle','--','Marker','s');hold?on;
p(4)?=?plot(h.p(3),t1,y31,'Color',C3);hold?on;
p(5)?=?plot(h.p(4),t1,y41,'Color',C4,'LineStyle','--','Marker','o');hold?on;
p(6)?=?plot(h.p(4),t1,y42,'Color',C4,'LineStyle','--','Marker','s');hold?on;
%?p(7)?=?bar(h.p(4),t1,y42,0.20,'FaceColor',C4);hold?on;?%?如果要畫柱狀圖的話h.xlim([0,5]);???????????????????????%?Set?X-Axis?Limits
h.autoscale;?????????????????????????%?Automatically?Scale?Y?Axis
h.autoy(3);??????????????????????????%?Autoscale?only?specified?y-axis
%?h.ylim(3,[95,105]);????????????????%?Set?Y-Limits?for?axis?3
%?h.ylim(4,[-3,8]);??????????????????%?Set?Y-Limits?for?axis?4
h.gridon;????????????????????????????%?Enable?grid?(use?h.gridoff?to?remove)?????????
h.ycolor(1,C1);??????????????????????%?Modify?the?y-Axis?Color
h.ycolor(2,C2);??????????????????????%?Modify?the?y-Axis?Color
h.ycolor(3,C3);??????????????????????%?Modify?the?y-Axis?Color
h.ycolor(4,C4);??????????????????????%?Modify?the?y-Axis?Color
h.ylabel(1,'First?Y-Axis?(Y1)');?????%?Add?y-Labels
h.ylabel(2,'Second?Y-Axis?(Y2)');????%?Add?y-Labels
h.ylabel(3,'Third?Y-Axis?(Y3)');?????%?Add?y-Labels
h.ylabel(4,'Another?Y-Axis(Y4)');????%?Add?y-Labels
h.xlabel('X-Axis');??????????????????%?Add?x-Label
h.fontsize(10);??????????????????????%?Change?all?font?sizes
h.position([0.1,0.15,0.8,0.75],0.12);?%?Position-Vector?and?Spacing?0.12%%?增添圖例
kk=legend(h.legendtarget,p,'Line?1','Line?2','Line?3','Line?4','Line?5','Line?6');
set(kk,'location','NorthOutside','Box',?'off','Orientation','horizontal','fontsize',10,'FontName',fontnamed);
%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1])
%%?設置完畢后,按照所需分辨率、格式輸出
figW?=?figureWidth;
figH?=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'myaxisc_example';
print(figureHandle,[fileout,'.png'],'-r800','-dpng');

16 【MATLAB】科研繪圖第十六期三Y軸圖

%%?三Y軸圖
%%?根據自己繪圖需求需要修改的有46,49,50,51,53,75和77%%?Made?by?Lwcah(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除環境變量
close?all;clear?all;clc;%%?1行1列-定義整幅圖出現的在電腦屏幕上的位置以及長和寬
figureHandle???=?figure;
figureUnits????=?'centimeters';
figureWidth????=?15;
figureHeight???=?8;
set(gcf,?'Units',?figureUnits,?'Position',?[0?0?figureWidth?figureHeight]);%%?定義字體和字號大小-通常的SCI一般Arial字體和10字號通用
fontnamed??????=?'Arial';?????????%?字號名字Arial
ssize??????????=?10;??????????????%?字號大小
%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(343);?????%?香水玫瑰
C2?=?chinesecolors(150);?????%?靛青
C3?=?chinesecolors(523);?????%?玫瑰灰
C4?=?chinesecolors(232);?????%?粉綠%%?加載數據
load?res_CRMN
x??=?1:1:18;
x??=?x';
y1?=?res_CRMN(:,3);??????????%?誤差
y2?=?res_CRMN(:,2);??????????%?均方根誤差
y3?=?res_CRMN(:,1);??????????%?相關系數%%?繪圖
[ax1,hlines1]?=?plotyn(x,y1,x,y2,x,y3);?%?畫三Y軸圖(主函數29行和子函數第56列要更改,修圖功能)%%?增添圖例
%?kk=legend(h.legendtarget,p,'Line?1','Line?2','Line?3','Line?4','Line?5','Line?6');
%?set(kk,'location','NorthOutside','Box',?'off','Orientation','horizontal','fontsize',10,'FontName',fontnamed);
%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1])
%%?設置完畢后,按照所需分辨率、格式輸出
figW????=?figureWidth;
figH????=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo_yaxis3';
print(figureHandle,[fileout,'.png'],'-r800','-dpng');

17 【MATLAB】科研繪圖第十七期雙Y軸圖

%%?三Y軸圖
%%?根據自己繪圖需求需要修改的有46,49,50,51,53,75和77%%?Made?by?Lwcah(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除環境變量
close?all;clear?all;clc;%%?1行1列-定義整幅圖出現的在電腦屏幕上的位置以及長和寬
figureHandle???=?figure;
figureUnits????=?'centimeters';
figureWidth????=?15;
figureHeight???=?7;
set(gcf,?'Units',?figureUnits,?'Position',?[0?0?figureWidth?figureHeight]);%%?定義字體和字號大小-通常的SCI一般Arial字體和10字號通用
fontnamed??????=?'Arial';?????????%?字號名字Arial
ssize??????????=?10;??????????????%?字號大小
%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(150);?????%?靛青
C2?=?chinesecolors(523);?????%?玫瑰灰
C3?=?chinesecolors(343);?????%?香水玫瑰
C4?=?chinesecolors(232);?????%?粉綠%%?加載數據
load?res_CRMN
x??=?1:1:18;
x??=?x';
y1?=?res_CRMN(:,3);??????????%?誤差
y2?=?res_CRMN(:,2);??????????%?均方根誤差%%?繪圖
yyaxis?left
h1?=?line?(x,y1,'LineStyle','--','Marker','o','LineWidth',1,'Color',C1,?'MarkerEdgeColor',C1,'MarkerFaceColor',C1);hold?on;
ylabel('Y1-axis','fontsize',ssize,'FontName',fontnamed,'Color',C1);
axis([0?19?-0.2?0]);%XY軸的范圍
xticks([1?2?3?4?5?6?7?8?9?10?11?12?13?14?15?16?17?18]);%畫格網的時候的小刻度
xticklabels({'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18'});%加x軸刻度標注
yticks([-0.20?-0.15?-0.10?-0.05?0]);%畫格網的時候的小刻度
yticklabels({'-0.20','-0.15','-0.10','-0.05','0'});%加y軸刻度標注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
set(gca,'ycolor',C1);yyaxis?right
h2?=?line?(x,y2,'LineStyle','--','Marker','o','LineWidth',1,'Color',C2,?'MarkerEdgeColor',C2,'MarkerFaceColor',C2);hold?on;
hold?on;box?on;grid?on;axis?on;?
ylabel('Y2-axis','fontsize',ssize,'FontName',fontnamed,'Color',C2);
axis([0?19?0.2?0.6]);%XY軸的范圍
%?xticks([1?2?3?4?5?6?7?8?9?10?11?12?13?14?15?16?17?18]);%畫格網的時候的小刻度
%?xticklabels({'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18'});%加x軸刻度標注
yticks([0.2?0.3?0.4?0.5?0.6]);%畫格網的時候的小刻度
yticklabels({'0.2','0.3','0.4','0.5','0.6'});%加y軸刻度標注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
set(gca,'ycolor',C2);xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);%%?增添圖例
kk=legend([h1,h2],'L1','L2');
set(kk,'location','North','Box',?'off','fontsize',ssize,'orientation','horizontal','FontName',fontnamed);%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1])
%%?設置完畢后,按照所需分辨率、格式輸出
figW????=?figureWidth;
figH????=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo_yaxis2';
print(figureHandle,[fileout,'.png'],'-r800','-dpng');

18 【MATLAB】科研繪圖第十八期散點密度圖

%%?散點密度圖%%?Made?by?Lwcah?in?2023-06-26(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除環境變量
close?all;clear?all;clc;%%?1行1列-定義整幅圖出現的在電腦屏幕上的位置以及長和寬
figureHandle???=?figure;
figureUnits????=?'centimeters';
figureWidth????=?15;
figureHeight???=?16;
set(gcf,?'Units',?figureUnits,?'Position',?[2?2?figureWidth?figureHeight]);
%定義子圖在圖中的x,y以及長和寬
pos54???????????????????=?zeros(20,4);
pos54(:,3)??????????????=?0.23;???????????????????%?長x
pos54(:,4)??????????????=?0.19;???????????????????%?寬y
pos54([17?18?19?20],2)??=?0.05;???????????????????%?y
pos54([13?14?15?16],2)??=?0.24;???????????????????%?y
pos54([9?10?11?12],2)???=?0.43;???????????????????%?y
pos54([5?6?7?8],2)??????=?0.62;???????????????????%?y
pos54([1?2?3?4],2)??????=?0.81;???????????????????%?y
pos54([1?5?9?13?17],1)??=?0.07;???????????????????%?x
pos54([2?6?10?14?18],1)?=?0.30;???????????????????%?x
pos54([3?7?11?15?19],1)?=?0.53;???????????????????%?x
pos54([4?8?12?16?20],1)?=?0.76;???????????????????%?x%%?定義字體和字號大小-通常的SCI一般Arial字體和10字號通用
fontnamed??????=?'Arial';?????????%?字號名字Arial
ssize??????????=?10;??????????????%?字號大小
%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(150);?????%?靛青
C2?=?chinesecolors(523);?????%?玫瑰灰
C3?=?chinesecolors(343);?????%?香水玫瑰
C4?=?chinesecolors(232);?????%?粉綠%%?加載數據
load?x
load?y
res_CRMN???????????????????????????????????????????=?[];????????????????????%?用于存儲反演的精度結果%%?繪圖
subplot('position',pos54(1,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(a)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(2,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(b)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(3,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(c)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(4,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(d)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(5,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(e)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(6,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(f)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(7,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(g)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(8,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(h)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(9,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(i)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(10,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(j)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(11,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(k)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(12,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(l)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(13,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(m)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(14,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(n)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(15,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(o)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(16,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
text(0,4.5,'(p)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(17,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(q)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(18,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(r)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(19,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(s)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(20,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc(res_CRMN,x,y,C1,C2);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(t)','fontsize',ssize,'FontName',fontnamed);%%?增添圖例
%?kk=legend([h1,h2],'L1','L2');
%?set(kk,'location','North','Box',?'off','fontsize',ssize,'orientation','horizontal','FontName',fontnamed);%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1])
%%?設置完畢后,按照所需分辨率、格式輸出
figW????=?figureWidth;
figH????=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo4_scatter_density5x4';
print(figureHandle,[fileout,'.png'],'-r800','-dpng');

19 【MATLAB】科研繪圖第十九期散點密度圖強化版

%%?散點密度圖%%?Made?by?Lwcah?in?2023-06-26(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除環境變量
close?all;clear?all;clc;%%?1行1列-定義整幅圖出現的在電腦屏幕上的位置以及長和寬
figureHandle???=?figure;
figureUnits????=?'centimeters';
figureWidth????=?15;
figureHeight???=?16;
set(gcf,?'Units',?figureUnits,?'Position',?[2?2?figureWidth?figureHeight]);
%定義子圖在圖中的x,y以及長和寬
pos54???????????????????=?zeros(20,4);
pos54(:,3)??????????????=?0.23;???????????????????%?長x
pos54(:,4)??????????????=?0.19;???????????????????%?寬y
pos54([17?18?19?20],2)??=?0.05;???????????????????%?y
pos54([13?14?15?16],2)??=?0.24;???????????????????%?y
pos54([9?10?11?12],2)???=?0.43;???????????????????%?y
pos54([5?6?7?8],2)??????=?0.62;???????????????????%?y
pos54([1?2?3?4],2)??????=?0.81;???????????????????%?y
pos54([1?5?9?13?17],1)??=?0.07;???????????????????%?x
pos54([2?6?10?14?18],1)?=?0.30;???????????????????%?x
pos54([3?7?11?15?19],1)?=?0.53;???????????????????%?x
pos54([4?8?12?16?20],1)?=?0.76;???????????????????%?x%%?定義字體和字號大小-通常的SCI一般Arial字體和10字號通用
fontnamed??????=?'Arial';?????????%?字號名字Arial
ssize??????????=?10;??????????????%?字號大小
%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(150);?????%?靛青
C2?=?chinesecolors(523);?????%?玫瑰灰
C3?=?chinesecolors(343);?????%?香水玫瑰
C4?=?chinesecolors(232);?????%?粉綠%%?加載數據
load?x
load?y
res_CRMN???????????????????????????????????????????=?[];????????????????????%?用于存儲反演的精度結果%%?繪圖
subplot('position',pos54(1,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(a)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(2,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(b)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(3,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(c)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(4,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(d)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(5,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(e)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(6,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(f)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(7,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(g)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(8,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(h)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(9,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(i)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(10,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(j)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(11,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(k)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(12,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(l)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(13,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(m)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(14,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(n)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(15,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(o)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(16,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
text(0,4.5,'(p)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(17,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(q)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(18,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(r)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(19,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(s)','fontsize',ssize,'FontName',fontnamed);subplot('position',pos54(20,:));
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]?=?plotcc_contourf(res_CRMN,x,y,C1,C2);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
text(0,4.5,'(t)','fontsize',ssize,'FontName',fontnamed);%%?增添圖例
%?kk=legend([h1,h2],'L1','L2');
%?set(kk,'location','North','Box',?'off','fontsize',ssize,'orientation','horizontal','FontName',fontnamed);%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1])
%%?設置完畢后,按照所需分辨率、格式輸出
figW????=?figureWidth;
figH????=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo4_scatter_density5x4';
print(figureHandle,[fileout,'.png'],'-r800','-dpng');

20 【MATLAB】科研繪圖第二十期散點密度雙柱狀圖

%%?表示散點分布的雙柱狀統計圖%%?Made?by?Lwcah(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除變量
close?all;clear?all;clc;%%?1行1列
%%?一幅圖的時候figureWidth?=?8.5;figureHeight?=?8;調整這兩個參數就可以
%定義整幅圖出現的在電腦屏幕上的位置以及長和寬
%這里有必要解釋一下為什么figureWidth要設置為8.5;
%因詳細解釋需要很長的篇幅,請轉公眾號觀看該天的文章。
figureHandle?=?figure;
figureUnits?=?'centimeters';
figureWidth?=?8.5;
figureHeight?=?6;
set(gcf,?'Units',?figureUnits,?'Position',?[28?20?figureWidth?figureHeight]);
%?注:28代表出圖時圖的左下角相對于整個電腦屏幕的左下角向左偏移28個單位,向上偏移20個單位。
%?可自行調節兩個數字讓圖出在自己屏幕的某個位置%%?定義字體和字號大小
%%?通常的SCI一般Arial字體和10字號通用
fontnamed='華文中宋';??%?字號名字Arial
ssize=10;?????????????%?字號大小
%%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(150);?%?靛青
C2?=?chinesecolors(523);?%?玫瑰灰
C3?=?chinesecolors(343);?%?香水玫瑰
C4?=?chinesecolors(148);?%?海濤藍%%?數據
load?x
load?y%%?表示散點分布的雙柱狀統計圖繪圖subplot(2,2,2);
%%?繪圖
res_CRMN???????????????????????????????????????????=?[];
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]=plotcc(res_CRMN,x,y,C1,C2);%?用于存儲反演的精度結果
%?是否添加X,Y軸標簽
title('scatter?density?1','fontsize',ssize,'FontName',fontnamed,'horiz','center');
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
%?text(-0.9,4.5,'(a)','fontsize',ssize,'FontName',fontnamed);
text(-0.4,4.5,str_C,'fontsize',ssize,'FontName',fontnamed);
text(-0.4,3.9,str_RMSE,'fontsize',ssize,'FontName',fontnamed);
text(-0.4,3.3,str_M,'fontsize',ssize,'FontName',fontnamed);
text(-0.4,2.7,str_N,'fontsize',ssize,'FontName',fontnamed);
axis?on;?h1?=?gca;?
hold?on;box?on;grid?on;subplot(2,2,4);
[n1,ctr1]?=?hist(x,20);
bar(ctr1,-n1,1,'FaceColor',C4);%,'EdgeColor','none','FaceAlpha',0.7
axis?off;?h2?=?gca;
h2.XLim=h1.XLim;
h2.XColor='none';
h2.YTickLabel='';
h2.TickDir='out';subplot(2,2,1);
[n2,ctr2]?=?hist(y,20);
barh(ctr2,-n2,1,'FaceColor',C4);%,'EdgeColor','none','FaceAlpha',0.7
axis?off;?h3?=?gca;
h3.YLim=h1.YLim;
h3.YColor='none';
h3.XTickLabel='';
h3.TickDir='out';h1.Position?=?[0.31?0.35?0.53?0.55];
h2.Position?=?[0.31?0.03?0.53?0.15];
h3.Position?=?[0.03?0.35?0.15?0.55];%%?修圖的標準格式代碼
%?text(0.5,0.9,'(a)?XXX','fontsize',ssize,'FontName',fontnamed);%,'horiz','center'
%?title('1000');
%?xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
%?ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
%?axis([0?10?0?7]);%XY軸的范圍
%?xticks([1?2?3?4?5?6?7?8?9?10]);%畫格網的時候的小刻度
%?xticklabels({'1','2','3','4','5','6','7','8','9','10'});%加x軸刻度標注
%?yticks([1?2?3?4?5?6]);%畫格網的時候的小刻度
%?yticklabels({'1','2','3','4','5','6'});%加y軸刻度標注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
%?set(gca,'yticklabel',[]);%y軸不顯示
%?set(gca,'xticklabel',[]);%x軸不顯示
grid?on;box?on;hold?on;%%?畫legend
%?hLegend1=legend('A1',?'A2',?'A3','Location',?'northeast','Box',?'off','Orientation','horizontal','fontsize',ssize,'FontName',fontnamed);
%方法一
%?kk=legend('h1');
%?set(kk,'location','NorthEast','Box',?'off','fontsize',ssize,'FontName',fontnamed);%'orientation','horizontal',
%方法二
%?columnlegend(2,{'L1','L2','L3','L4','L5','L6'},'North');%表示一行放三個圖例以及圖例的位置%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1]);
%%?設置完畢后,按照所需分辨率、格式輸出
figW?=?figureWidth;
figH?=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo1_scartter_double_bar';
print(figureHandle,[fileout,'.png'],'-r600','-dpng');

21 【MATLAB】科研繪圖第二十一期散點密度雙柱狀圖強化版

%%?表示散點分布的雙柱狀統計圖%%?Made?by?Lwcah?(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除變量
close?all;clear?all;clc;%%?1行1列
%%?一幅圖的時候figureWidth?=?8.5;figureHeight?=?8;調整這兩個參數就可以
%定義整幅圖出現的在電腦屏幕上的位置以及長和寬
%這里有必要解釋一下為什么figureWidth要設置為8.5;
%因詳細解釋需要很長的篇幅,請轉公眾號觀看該天的文章。
figureHandle?=?figure;
figureUnits?=?'centimeters';
figureWidth?=?8.5;
figureHeight?=?6;
set(gcf,?'Units',?figureUnits,?'Position',?[28?20?figureWidth?figureHeight]);
%?注:28代表出圖時圖的左下角相對于整個電腦屏幕的左下角向左偏移28個單位,向上偏移20個單位。
%?可自行調節兩個數字讓圖出在自己屏幕的某個位置%%?定義字體和字號大小
%%?通常的SCI一般Arial字體和10字號通用
fontnamed='華文中宋';??%?字號名字Arial
ssize=10;?????????????%?字號大小
%%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(150);?%?靛青
C2?=?chinesecolors(523);?%?玫瑰灰
C3?=?chinesecolors(343);?%?香水玫瑰
C4?=?chinesecolors(135);?%?海濤藍%%?數據
load?x
load?y%%?表示散點分布的雙柱狀統計圖繪圖subplot(2,2,2);
%%?繪圖
res_CRMN???????????????????????????????????????????=?[];
[res_CRMN,str_equation,str_C,str_RMSE,str_M,str_N]=plotcc_contourf(res_CRMN,x,y,C1,C2);%?用于存儲反演的精度結果
%?是否添加X,Y軸標簽
title('scatter?density?1','fontsize',ssize,'FontName',fontnamed,'horiz','center');
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
%?text(-0.9,4.5,'(a)','fontsize',ssize,'FontName',fontnamed);
text(-0.4,4.5,str_C,'fontsize',ssize,'FontName',fontnamed);
text(-0.4,3.9,str_RMSE,'fontsize',ssize,'FontName',fontnamed);
text(-0.4,3.3,str_M,'fontsize',ssize,'FontName',fontnamed);
text(-0.4,2.7,str_N,'fontsize',ssize,'FontName',fontnamed);
axis?on;?h1?=?gca;?
hold?on;box?on;grid?on;subplot(2,2,4);
[n1,ctr1]?=?hist(x,20);
bar(ctr1,-n1,1,'FaceColor',C4);%,'EdgeColor','none','FaceAlpha',0.7
axis?off;?h2?=?gca;
h2.XLim=h1.XLim;
h2.XColor='none';
h2.YTickLabel='';
h2.TickDir='out';subplot(2,2,1);
[n2,ctr2]?=?hist(y,20);
barh(ctr2,-n2,1,'FaceColor',C4);%,'EdgeColor','none','FaceAlpha',0.7
axis?off;?h3?=?gca;
h3.YLim=h1.YLim;
h3.YColor='none';
h3.XTickLabel='';
h3.TickDir='out';h1.Position?=?[0.31?0.35?0.53?0.55];
h2.Position?=?[0.31?0.03?0.53?0.15];
h3.Position?=?[0.03?0.35?0.15?0.55];%%?修圖的標準格式代碼
%?text(0.5,0.9,'(a)?XXX','fontsize',ssize,'FontName',fontnamed);%,'horiz','center'
%?title('1000');
%?xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
%?ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
%?axis([0?10?0?7]);%XY軸的范圍
%?xticks([1?2?3?4?5?6?7?8?9?10]);%畫格網的時候的小刻度
%?xticklabels({'1','2','3','4','5','6','7','8','9','10'});%加x軸刻度標注
%?yticks([1?2?3?4?5?6]);%畫格網的時候的小刻度
%?yticklabels({'1','2','3','4','5','6'});%加y軸刻度標注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
%?set(gca,'yticklabel',[]);%y軸不顯示
%?set(gca,'xticklabel',[]);%x軸不顯示
grid?on;box?on;hold?on;%%?畫legend
%?hLegend1=legend('A1',?'A2',?'A3','Location',?'northeast','Box',?'off','Orientation','horizontal','fontsize',ssize,'FontName',fontnamed);
%方法一
%?kk=legend('h1');
%?set(kk,'location','NorthEast','Box',?'off','fontsize',ssize,'FontName',fontnamed);%'orientation','horizontal',
%方法二
%?columnlegend(2,{'L1','L2','L3','L4','L5','L6'},'North');%表示一行放三個圖例以及圖例的位置%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1]);
%%?設置完畢后,按照所需分辨率、格式輸出
figW?=?figureWidth;
figH?=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo1_scartter_double_bar';
print(figureHandle,[fileout,'.png'],'-r600','-dpng');

22 【MATLAB】科研繪圖第二十二期三維瀑布圖

%%?Made?by?Lwcah(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、視頻號、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?繪制模板
close?all;clear?all;clc;%%?1行1列
%%?一幅圖的時候figureWidth?=?8.5;figureHeight?=?8;調整這兩個參數就可以
%定義整幅圖出現的在電腦屏幕上的位置以及長和寬
%這里有必要解釋一下為什么figureWidth要設置為8.5;
%因詳細解釋需要很長的篇幅,請轉公眾號觀看該天的文章。
figureHandle?=?figure;
figureUnits?=?'centimeters';
figureWidth?=?15;
figureHeight?=?9;
set(gcf,?'Units',?figureUnits,?'Position',?[28?10?figureWidth?figureHeight]);
%?注:28代表出圖時圖的左下角相對于整個電腦屏幕的左下角向左偏移28個單位,向上偏移20個單位。
%?可自行調節兩個數字讓圖出在自己屏幕的某個位置%%?定義字體和字號大小
%%?通常的SCI一般Arial字體和10字號通用
fontnamed='Arial';%字號名字
ssize=10;%字號大小
%%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?一、信號分解并出圖
%?加載數據
load?data??????????????
x=data(:,1);
y=data(:,2);
%?展開信號分解
[imf,residual]=emd(y);
residual??????=?residual.*ones(size(y))';
modes?????????=?[imf;residual];%%?構造XYZ數據集
%?X軸應該為Imf代表的分量數
[m,n]?=?size(modes);%?m為幾個IMF分量;n為分量的數據長度。
X1????=?(1:1:m)';
X2????=?ones(size(modes));
X?????=?X1.*X2;
X?????=?X';
%?Y軸應該為Imf代表的分量數據長度
Y1????=?(1:1:n);
Y2????=?ones(size(modes));
Y?????=?Y1.*Y2;
Y?????=?Y';
%?Z軸呈現的為信號分解的數據(為了使畫圖更好看所以要調整順序)
Z?????=?modes;
Z?????=?[modes(8,:);modes(7,:);modes(6,:);modes(5,:);modes(4,:);modes(3,:);modes(2,:);modes(1,:)];%%?繪圖
plot3(X,Y,Z,'linewidth',1);
hTitle?=?title('Three-dimensional?waterfall?map');
hXLabel?=?xlabel('X');
hYLabel?=?ylabel('Y');
hZLabel?=?zlabel('Z');%%?畫圖的標準格式代碼
%?text(0.5,0.9,'(a)?XXX','fontsize',ssize,'FontName',fontnamed);%,'horiz','center'
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
zlabel('Z-axis','fontsize',ssize,'FontName',fontnamed);
%?axis([0?7?0?0.7?50?250]);%XYZ軸的范圍
%?xticks([1?2?3?4?5?6]);%畫格網的時候的小刻度
%?xticklabels({'1','2','3','4','5','6'});%加x軸刻度標注
%?yticks([0.1?0.2?0.3?0.4?0.5?0.6]);%畫格網的時候的小刻度
%?yticklabels({'0.1','0.2','0.3','0.4','0.5','0.6'});%加y軸刻度標注
%?zticks([50?100?150?200?250]);%畫格網的時候的小刻度
%?zticklabels({'50','100','150','200','250'});%加z軸刻度標注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
%?set(gca,'zticklabel',[]);%z軸不顯示
%?set(gca,'yticklabel',[]);%y軸不顯示
%?set(gca,'xticklabel',[]);%x軸不顯示
grid?on;box?on;hold?on;%%?畫legend
%方法一
kk=legend('L8','L7','L6','L5','L4','L3','L2','L1');
set(kk,'location','NorthEast','Box',?'off','fontsize',ssize,'FontName',fontnamed);%'orientation','horizontal',
%方法二
%?columnlegend(2,{'L1','L2','L3','L4','L5','L6'},'North');%表示一行放三個圖例以及圖例的位置
%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1])
%%?設置完畢后,按照所需分辨率、格式輸出
figW?=?figureWidth;
figH?=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'三維瀑布圖';
print(figureHandle,[fileout,'.png'],'-r600','-dpng');%%?一幅圖的時候figureWidth?=?8.5;figureHeight?=?8;調整這兩個參數就可以
%定義整幅圖出現的在電腦屏幕上的位置以及長和寬
%這里有必要解釋一下為什么figureWidth要設置為8.5;
%因詳細解釋需要很長的篇幅,請轉公眾號觀看2023-03-21的文章觀看。
figureHandle?=?figure;
figureUnits??=?'centimeters';
figureWidth??=?8.5;
figureHeight?=?14;
set(gcf,?'Units',?figureUnits,?'Position',?[20?12?figureWidth?figureHeight]);
%%?展開信號分解
[imf,residual]=emd(y);
residual??????=?residual.*ones(size(y))';
modes?????????=?[imf;residual];
%信號重構
d1???????????=?modes(1,:);
d2???????????=?modes(2,:);
d3???????????=?modes(3,:);
d4???????????=?modes(4,:);
d5???????????=?modes(5,:);
d6???????????=?modes(6,:);
d7???????????=?modes(7,:);
d8???????????=?modes(8,:);
%?d9???????????=?modes(9,:);
%?d10??????????=?modes(10,:);
%%?畫圖
subplot(9,1,1)
plot(x,y);
ylabel('原信號');hold?on;
subplot(9,1,2)
plot(x,d1);
ylabel('d1');hold?on;
subplot(9,1,3)
plot(x,d2);
ylabel('d2');hold?on;
subplot(9,1,4)
plot(x,d3);
ylabel('d3');hold?on;
subplot(9,1,5)
plot(x,d4);
ylabel('d4');hold?on;
subplot(9,1,6)
plot(x,d5);
ylabel('d5');hold?on;
subplot(9,1,7)
plot(x,d6);
ylabel('d6');hold?on;
subplot(9,1,8)
plot(x,d7);
ylabel('d7');hold?on;
subplot(9,1,9)
plot(x,d8);
ylabel('d8');hold?on;
%?subplot(11,1,10)
%?plot(x,d9);
%?ylabel('d9');hold?on;
%?subplot(11,1,11)
%?plot(x,d10);
%?ylabel('d10');hold?on;
xlabel('X-axis');
%%?背景顏色
set(gcf,'Color',[1?1?1])
%%?圖片輸出
figW????=?figureWidth;
figH????=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'原始數據分解各分量';
print(figureHandle,[fileout,'.png'],'-r600','-dpng');

23 【MATLAB】科研繪圖第二十三期箭頭圖

%%?箭頭圖
%%?Made?by?Lwcah?(公眾號:Lwcah)
%%?公眾號:Lwcah
%%?知乎、B站、小紅書、抖音同名賬號:Lwcah,感謝關注~
%%?更多MATLAB+SCI繪圖教程敬請觀看~%%?清除變量
close?all;clear?all;clc;%%?1行1列
%%?一幅圖的時候figureWidth?=?8.5;figureHeight?=?8;調整這兩個參數就可以
%定義整幅圖出現的在電腦屏幕上的位置以及長和寬
%這里有必要解釋一下為什么figureWidth要設置為8.5;
%因詳細解釋需要很長的篇幅,請轉公眾號觀看該天的文章。
figureHandle?=?figure;
figureUnits?=?'centimeters';
figureWidth?=?8.5;
figureHeight?=?6;
set(gcf,?'Units',?figureUnits,?'Position',?[28?20?figureWidth?figureHeight]);
%?注:28代表出圖時圖的左下角相對于整個電腦屏幕的左下角向左偏移28個單位,向上偏移20個單位。
%?可自行調節兩個數字讓圖出在自己屏幕的某個位置%%?定義字體和字號大小
%%?通常的SCI一般Arial字體和10字號通用
fontnamed='華文中宋';%字號名字Arial
ssize=10;%字號大小
%%?如果是中文論文可以相應的更改字號名字如下
%?'華文中宋'?'華文仿宋'?'華文宋體'?'華文新魏'?'華文楷體'
%?'華文琥珀'?'華文細黑'?'華文行楷'?'華文隸書'?'宋體'
%?'方正姚體'?'微軟雅黑'?'方正舒體'?'新宋體'
%?'幼圓'?'楷體'?'等線'?'隸書'?'黑體'%%?給定繪圖顏色
C1?=?chinesecolors(343);%香水玫瑰
C2?=?chinesecolors(150);%靛青
C3?=?chinesecolors(523);%玫瑰灰
%?C4?=?chinesecolors(17);%鵝冠紅%%?加載數據
%?以MATLAB自帶的北美上空氣流的采樣數據為例
%?向量?X?和?Y?表示每個箭頭的起始點位置(經緯度),U?和?V?表示每個箭頭的定向分量。
load('wind','x','y','u','v')
X?=?x(11:22,11:22,1);
Y?=?y(11:22,11:22,1);
U?=?u(11:22,11:22,1);
V?=?v(11:22,11:22,1);
quiver(X,Y,U,V)
%?axis?equal%%?修圖的標準格式代碼
%?text(0.5,0.9,'(a)?XXX','fontsize',ssize,'FontName',fontnamed);%,'horiz','center'
%?title('1000');
xlabel('經度/°','fontsize',ssize,'FontName',fontnamed);
ylabel('緯度/°','fontsize',ssize,'FontName',fontnamed);
%?axis([0?10?0?7]);%XY軸的范圍
%?xticks([1?2?3?4?5?6?7?8?9?10]);%畫格網的時候的小刻度
%?xticklabels({'1','2','3','4','5','6','7','8','9','10'});%加x軸刻度標注
%?yticks([1?2?3?4?5?6]);%畫格網的時候的小刻度
%?yticklabels({'1','2','3','4','5','6'});%加y軸刻度標注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
%?set(gca,'yticklabel',[]);%y軸不顯示
%?set(gca,'xticklabel',[]);%x軸不顯示
grid?on;box?on;hold?on;%%?畫legend
%?hLegend1=legend('A1',?'A2',?'A3','Location',?'northeast','Box',?'off','Orientation','horizontal','fontsize',ssize,'FontName',fontnamed);
%方法一
%?kk=legend('h1');
%?set(kk,'location','NorthEast','Box',?'off','fontsize',ssize,'FontName',fontnamed);%'orientation','horizontal',
%方法二
%?columnlegend(2,{'L1','L2','L3','L4','L5','L6'},'North');%表示一行放三個圖例以及圖例的位置%%?Matlab中有許多位置可以選擇:
%?'North'?inside?plot?box?near?top
%?'South'?inside?bottom
%?'East'?inside?right
%?'West'?inside?left
%?'NorthEast'?inside?top?right?(default?for?2-D?plots)
%?'NorthWest'?inside?top?left
%?'SouthEast'?inside?bottom?right
%?'SouthWest'?inside?bottom?left
%?'NorthOutside'?outside?plot?box?near?top
%?'SouthOutside'?outside?bottom
%?'EastOutside'?outside?right
%?'WestOutside'?outside?left
%?'NorthEastOutside'?outside?top?right?(default?for?3-D?plots)
%?'NorthWestOutside'?outside?top?left
%?'SouthEastOutside'?outside?bottom?right
%?'SouthWestOutside'?outside?bottom?left
%?'Best'?least?conflict?with?data?in?plot?與繪圖中的數據沖突最小
%?'BestOutside'?least?unused?space?outside?plot%%?背景顏色
set(gcf,'Color',[1?1?1]);
%%?設置完畢后,按照所需分辨率、格式輸出
figW?=?figureWidth;
figH?=?figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0?0?figW?figH]);
fileout?=?'demo_quiver';
print(figureHandle,[fileout,'.png'],'-r600','-dpng');


本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/167488.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/167488.shtml
英文地址,請注明出處:http://en.pswp.cn/news/167488.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

LeetCode二叉樹小題目

Q1將有序數組轉換為二叉搜索樹 題目大致意思就是從一個數組建立平衡的二叉搜索樹。由于數組以及進行了升序處理,我們只要考慮好怎么做到平衡的。平衡意味著左右子樹的高度差不能大于1。由此我們可以想著是否能用類似二分遞歸來解決。 如果left>right,直接返回nul…

IO多路轉接之epoll

目錄 一. epoll的實現原理 二. epoll的相關接口 2.1 epoll_create -- 創建epoll模型 2.2 epoll_ctl -- 對epoll模型進行控制 2.3 epoll_wait -- 等待epoll所關注的事件就緒 2.4 epoll相關接口的使用方法 三. Epoll服務器的模擬實現 3.1 EpollServer類的聲明 3.2 Epoll…

網工內推 | 美的、得力集團,包吃包住,IE認證優先,14薪

01 美的 招聘崗位:網絡工程師 職責描述: 1.負責IT網絡設備、IDC機房的日常維護巡檢、監控和管理; 2.負責路由、交換、防火墻、無線控制器、AP等網絡設備的開通、調整、優化升級; 3.負責公司OT、IT網絡規劃,項目實施以…

路由VRRP配置例子

拓樸如下: 主要配置如下: [R1] interface GigabitEthernet0/0/0ip address 10.1.1.1 255.255.255.0 vrrp vrid 1 virtual-ip 10.1.1.254vrrp vrid 1 priority 200vrrp vrid 1 preempt-mode timer delay 20 # interface GigabitEthernet0/0/1ip address …

【10套模擬】【10】

關鍵字: 線性探測次數、冒泡交換性質、排序次數最值、bst查找關鍵字最多比較次數、m叉樹空指針域 鏈表合并、二叉排序樹查找x、堆排序

flink的集成測試

背景 日常測試中我們使用flink的TestHarness只能測試單個算子,很多情況下我們需要集成測試來測試真正的問題,所以在flink中進行集成測試還是非常有必要的,本文就來記錄下如何在flink中進行集成測試 flink中進行集成測試 flink中進行集成測…

css給盒子寫四個角

如圖:之前一直用定位 現在發現可以用css寫 background: linear-gradient(to top, #306eef, #306eef) left top no-repeat, /*上左*/ linear-gradient(to right, #306eef, #386eef) left top no-repeat, /*左上*/ linear-gradient(to left, #386eef, #306eef) righ…

查找學習筆記

1、靜態查找表 以下查找的索引均從1開始 &#xff08;1&#xff09;順序查找&#xff08;帶哨兵&#xff09; #include<iostream> #include<vector>using namespace std;int search(vector<int> arr, int key) {arr[0] key;int i;for (i arr.size() - 1…

代碼隨想錄 860. 檸檬水找零

題目 在檸檬水攤上&#xff0c;每一杯檸檬水的售價為 5 美元。顧客排隊購買你的產品&#xff0c;&#xff08;按賬單 bills 支付的順序&#xff09;一次購買一杯。 每位顧客只買一杯檸檬水&#xff0c;然后向你付 5 美元、10 美元或 20 美元。你必須給每個顧客正確找零&#xf…

python opencv -模板匹配

python opencv -模板匹配 模板匹配就是&#xff0c;我們現有一個模板和一個圖片&#xff0c;然后&#xff0c;在這個圖片中尋找和模板近似的部分。 在opencv 中主要通過cv2.matchTemplate這個函數去實現。 下面我們先看一下&#xff0c;模板圖片和需要匹配的圖片&#xff1a…

(Matalb時序預測)GA-BP遺傳算法優化BP神經網絡的多維時序回歸預測

目錄 一、程序及算法內容介紹&#xff1a; 基本內容&#xff1a; 亮點與優勢&#xff1a; 二、實際運行效果&#xff1a; 三、部分代碼 四、本文代碼數據說明手冊分享&#xff1a; 一、程序及算法內容介紹&#xff1a; 基本內容&#xff1a; 本代碼基于Matalb平臺編譯&am…

Spring IOC 和 AOP

Spring IOC 什么是 IoC ? IoC &#xff08;Inversion of Control 控制反轉&#xff09;是一種設計思想&#xff0c;而不是一個具體的技術實現。IoC 的思想就是將原本在程序中手動創建對象的控制權&#xff0c;交由給 Spring 框架來管理。 為什么叫控制反轉&#xff1f; 控制…

unsigned詳講(干貨滿滿)

前言&#xff1a;過年偷懶了(●ˇ?ˇ●)&#xff0c;但是年后開學了一定要恢復學習狀態&#xff0c;在復習加繼續學習的途中&#xff0c;我發現對于unsigned關鍵字的掌握并不是很熟練&#xff0c;于是翻閱了各個大佬的博客以及書籍&#xff0c;總結了對于unsigned的一些知識點…

數據結構與算法編程題18

循環隊列相關代碼。 #include <iostream> using namespace std;#define Maxsize 100 #define ERROR 0 #define OK 1 typedef int Elemtype; typedef struct Queue {Elemtype data[Maxsize];int front;int rear; }Queue;void Init_Queue(Queue &Q) {Q.front Q.rear …

P9 C++類

目錄 01 類是什么 02 如何創建類 03 方法 后話 本期我們要講的是 C 中的類。 我們終于講到了面向對象編程&#xff0c;這是一種非常流行的編程方式&#xff0c;面向對象編程實際上只是一種你可以采用的編寫代碼的方式&#xff0c;其他語言例如 C#、Java 這些主要是面向對象…

白嫖CTG4.0

大家好&#xff0c;到點了我來給各位大佬獻策CTG&#xff0c;不是花錢買不起&#xff0c;而是免費更有性價比&#xff0c;哈哈哈不調侃了我們自此開始正文&#xff0c;咱們主打的就是一個分享是一種態度 當然我更希望大家支持國產對國產有自己的信心&#xff08;文心一言&…

Git常用命令詳細總結,更適合中國寶寶體質

文章目錄 代碼倉庫創建倉庫1.進入需要創建代碼庫的文件夾2.創建/切始化倉庫3.關聯遠程倉庫拉取遠程倉庫到本地 添加文件到倉庫1.查看工作區狀態2.添加文件到暫存區3.提交到本地倉庫4.對比工作區文件變化 倉庫配置1.配置全局用戶名和郵箱2.配當前倉庫用戶名和郵箱3.查看Git全局配…

Selenium中常用的JS操作總結

? 目錄 前言&#xff1a; JS相關操作 JS Xpath定位 獲取單個元素 獲取元素集合 文本輸入 獲取坐標 獲取瀏覽器窗口的內部高度 獲取瀏覽器窗口的內部寬度&#xff1b; 坐標計算 設置樣式 設置窗口大小 類數組對象arguments JQuery選擇器 jQuery 選擇器 jQuery …

多模態——使用stable-video-diffusion將圖片生成視頻

多模態——使用stable-video-diffusion將圖片生成視頻 0. 內容簡介1. 運行環境2. 模型下載3. 代碼梳理3.1 修改yaml文件中的svd路徑3.2 修改DeepFloyDataFiltering的vit路徑3.3 修改open_clip的clip路徑3.4 代碼總體結構 4. 資源消耗5. 效果預覽 0. 內容簡介 近期&#xff0c;…

Linux上安裝Redis

案例中Linux版本為CentOS7.9&#xff0c;安裝目錄為 /root/software/ 1、使用 wget 命令從官網下載安裝包 wget https://github.com/redis/redis/archive/7.2.3.tar.gz2、解壓縮 tar -xzf 7.2.3.tar.gz3、進入解壓后的目錄 cd redis-7.2.34、 編譯和安裝Redis make make i…