clc
close all
clear
%% 導入數(shù)據(jù)
pathFigure= '.\Figures\' ;
Name =["生活","生態(tài)","工業(yè)","農業(yè)","匯總"];
xLables =['Ⅰ';'Ⅱ';'Ⅲ'];
mycolor =[53,42,134;21,132,212;55,184,156;215,186,84;247,250,13]./255;x =[123];
XX =[0003.922.780006.634.20.788.379.9822.1515.46];figure(1);holdon;boxon;
h =bar( XX ,'FaceColor','flat');for k =1:size(XX,2)h(k).FaceColor =mycolor(k,:);
end
set(gca,'XTick', x , 'XTickLabel',xLables);set(gca,'FontSize',12,'Fontname', 'Times New Roman');xlabel("情景",'FontName','宋體','FontSize',14,'Fontweight','bold');% 后續(xù)調整坐標標題
ylabel("\fontname{宋體}\fontsize{15}缺水率(\fontname{Times New Roman}\fontsize{15}%\fontname{宋體}\fontsize{15})",'FontSize',14,'Fontweight','bold');% 后續(xù)調整坐標標題
hl =legend( Name );set(hl,'Box','off','location','NorthWest','NumColumns',1,'FontSize',12,'FontName','宋體');
ax1 = gca;
ax1.FontSize =12;
ax1.LineWidth =1;set(gca,'Layer','top');str=strcat(pathFigure,"Figure1", '.tiff');print(gcf, '-dtiff', '-r600', str);
2 繪制漸變柱狀圖
看論文時,被這種圖深深吸引了,如果想要在MATLAB中繪制以下圖形,應當如何實現(xiàn)呢?
圖源:J2022-Observed decrease in light precipitation in part due to urbanization-Scientific Reports