I often need to make pretty cumbersome plotting definitions in MATLAB, an example of which can be seen below
figure(1)
clf
subplot(221)
hold on
plot(z(1,:),...
'LineWidth',2)
line([0,N], [R(1,1),R(1,1)],...
'color','red','linestyle','--','LineWidth',2)
hold off
grid on
xlabel('$k$',...
'interpreter','latex','fontsize',14)
ylabel('$h_1$',...
'Interpreter','latex','FontSize',14)
legend({'closed loop','setpoint'},...
'location','best','fontsize',14)
For simplicities sake I have only included one of four subplots. In these plots I end up writing
and
quite a lot. I am asking if there is a better way to do this given that the font size and interpreter type is the same for my xlabel, ylabel, and legend which it very often is for me.
I have seen some pages recommending I use something along the lines of
But this doesnt work for the labels for me.
TLDR: What is a "good" coding style way of configuring the tedious plot options like font size and interpreter en masse.
Best Answer