clear all Dir_Prefix = 'D:\microplastic\data_0823\'; opts = spreadsheetImportOptions("NumVariables", 1); opts.Sheet = "Summary"; opts.VariableNames = "Totalmismanagedplasticwastetons"; opts.VariableTypes = "double"; DataCoVMMPWS5 = table; ranges = ["D7:D7", "D13:D13", "D19:D19", "D24:D24", "D29:D29",... "D32:D32", "D35:D35", "D38:D38", "D41:D41", ... "D44:D44", "D47:D47", "D50:D50", "D53:D53", "D57:D57", "D61:D61"]; for idx = 1:length(ranges) opts.DataRange = ranges(idx); tb = readtable(strcat(Dir_Prefix,"Data-CoVMMPW.xlsx"), opts, "UseExcel", false); DataCoVMMPWS5 = [DataCoVMMPWS5; tb]; end clear idx opts ranges tb data = (DataCoVMMPWS5{:,1})'; x = [1 2 3 5 6 8 9 10 11 13 14 15 16 18 19]; y = [data(1,1) data(1,2) data(1,3)... data(1,4) data(1,5)... data(1,6) data(1,7) data(1,8) data(1,9) data(1,10) data(1,11) data(1,12) data(1,13)... data(1,14) data(1,15)]/1000000; y2=roundn(y,-2); %% figure hold on color_matrix = [1,.5,0.31 1,.385,0.155 1,.27,0 1,.5,0.31 1,.27,0 .24,.57,.25 .22,.37,.06 .2,.63,0.79 .24,.35,0.67 .24,.57,.25 .22,.37,.06 .2,.63,0.79 .24,.35,0.67 1,.5,0.31 1,.27,0 ]; for i = 1:15 b = bar(x(i),y(i),1); set(b,'facecolor',color_matrix(i,:),'edgecolor','none') end D_name = {'Hospital','Test Kits','PPE (surgical)','PPE (N95)','Packaging'}; set(gca,'XTickLabel',D_name,... 'fontsize',11,'FontName','Times new roman','fontweight','bold') grid off box off n = [2 5.5 9.5 14.5 18.5]; set(gca,'XTick',n,... 'ytick',0:13,... 'linewidth',1.2); xlabel('Sources','fontsize',15,'fontweight','bold'); ylabel('Generation (million ton)',... 'fontsize',15,... 'FontName','Times new roman',... 'fontweight','bold'); for i = 1:length(x) text(x(i)+0.2,y(i)+0.3,num2str(y2(i)),... 'HorizontalAlignment','center',... 'VerticalAlignment','bottom',... 'FontName','Times new roman',... 'Rotation',45,... 'fontsize',9); end print(gcf,'-dpng','-r300','Fig1.png')