Just make the additional adjustments to axes/line properties in each subplot as you create it.
As you've written it, that means adding the same code line six different places in the code for every additional line of code you need; rather tedious.
If you want to set a property for all subplots, you can do that using the cell array syntax of handles/properties for the set function, but to do that you needed to have saved the handles to all the axes instead of using a single variable repetitively as you had done above.
It would be more efficient coding to use a loop...
plotMonths=[1,3,6,12,24,48].';
plotColors=['r';'b';'k';'g';'o';'c'];
figure;
for i=1:6
hAx(i)=subplot(2,3,i);
hL(i)=plot(Date,SI_table.("SPI_"+plotMonths(i)+"month"), 'linewidth',1,plotColors(i));
xlabel('time step')
ylabel("SPI "+plotMonths(i)+"month")
xticks(Date(1:12:end))
set(hAx(i),'XTickLabelRotation',90)
end
Best Answer