plot - Reset ColorOrder index for plotting in Matlab / Octave -


i have matrices x1, x2, ... containing variable number of row vectors. successive plots

figure hold % or hold on plot(x1') plot(x2') plot(x3') 

matlab or octave iterates through colororder , plot each line in different color. but want each plot command start again first color in colororder, in default case first vector matrix should blue, second in green, third in red etc.

unfortunately cannot find property related color index niether method reset it.

you can shift original colororder in current axes new plot starts same color:

h=plot(x1'); set(gca, 'colororder', circshift(get(gca, 'colororder'), numel(h))) plot(x2'); 

you can wrap in function:

function h=plotc(x, varargin) h=plot(x, varargin{:}); set(gca, 'colororder', circshift(get(gca, 'colororder'), numel(h))); if nargout==0,     clear h end end 

and call

hold plotc(x1') plotc(x2') plotc(x3') 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -