Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB 'LineOrder' and 'ColorOrder' help

  1. Feb 7, 2008 #1
    For the life of me, I can't figure out how to set the color order and line order to cycle through the graphs of my program.

    What I have right now (and I've tried a bunch of different stuff in the past) is

    set(gca, 'ColorOrder', [0 0 1; 0 1 0; 1 0 0]);

    as the first line of my code, but it wont' cycle,a nd I'm currently going insane (just a little).

    Any help would be most apprecitaed.
  2. jcsd
  3. Feb 8, 2008 #2
    Please anyone? Also, if possible, I would like to not change the default order for future runs, since the program I'm writing will be used by tohers.
  4. Mar 1, 2009 #3
    You need to change the nextplot settings
    set(gca, 'ColorOrder', [0 0 1; 0 1 0; 1 0 0],'LineStyleOrder',{'-*',':','o'},'NextPlot','ReplaceChildren'),
    you can change the global settings too, I think 0 instead of gca will do it, but I haven't tried

    - J
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook