In the matlab documentation it says that it is possible to change the Matlab axis colors in a two y-axis figure by doing the following:
fig = figure;
left_color = [.5 .5 0];
right_color = [0 .5 .5];
set(fig,'defaultAxesColorOrder',[left_color; right_color]);
y = [1 2 3; 4 5 6];
yyaxis left
plot(y)
z = [6 5 4; 3 2 1];
yyaxis right
plot(z)
This works and produces the desired output.
Now I was trying to do the exact same figure but in a subplot. My code is the following:
fig = subplot(2,1,1);
left_color = [.5 .5 0];
right_color = [0 .5 .5];
set(fig,'defaultAxesColorOrder',[left_color; right_color]);
y = [1 2 3; 4 5 6];
yyaxis left
plot(y)
z = [6 5 4; 3 2 1];
yyaxis right
plot(z)
Here, however, it does not change the axis colors. Any thoughts on how to do this?

