Reset ColorOrder index for plotting in Matlab / Octave

前端 未结 5 1286
独厮守ぢ
独厮守ぢ 2021-02-07 15:47

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

figure
hold all % or hold on
plot(x1\'         


        
5条回答
  •  攒了一身酷
    2021-02-07 16:07

    Starting from R2014b there's a simple way to restart your color order.

    Insert this line every time you need to reset the color order.

    set(gca,'ColorOrderIndex',1)
    

    or

    ax = gca;
    ax.ColorOrderIndex = 1;
    

    see: http://au.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html

提交回复
热议问题