matrix=linspace(0,1,100)'*[1:4];
matrix2=linspace(0,1,102)'*(0.5+[1:4]);
figure; plot(matrix); hold on; plot(matrix2,'--') % try1
figure; plot(matrix); hold on; plot(matrix2,'--','SeriesIndex',1) % try2
For plot(matrix) automatically 4 lines are drawn with 4 distinct colors.
By using #try1
I get 8 lines with 7 distintc colors.
However, I would like to get matrix2 use the same colors as matrix 1 (since they indicate same physical meaning).
By using #try2
I get all lines of matrix2 just turned into blue.
IS there a simple way (e.g. not requiring to know in advance how many lines will be plotted, and how many plots are required following the hold on - so it should be automatic) to do that? I thought that 'SeriesIndex',1 should have handled that, but I guess I missunderstood its functionality.