From: Mayi DA on
Dear all
ColorOrder is used for plot line color in axes. However, when add a new plot line to an exist axes, it will plot the line from the beginning ColorOrder. Here is an example:
>> plot(rand(10,2)) % plot 2 lines in axes, which have blue and green color respectively
>> hold on;
>> plot(rand(10,1)) % add a new line, whose color is blue, i hope it can have red color.

So my question is: how to continue the colororder property when adding a new line?

Best Regards
mayi
2010-07-21
From: someone on
"Mayi DA" <damayi(a)gmail.com> wrote in message <i25g43$pro$1(a)fred.mathworks.com>...
> Dear all
> ColorOrder is used for plot line color in axes. However, when add a new plot line to an exist axes, it will plot the line from the beginning ColorOrder. Here is an example:
> >> plot(rand(10,2)) % plot 2 lines in axes, which have blue and green color respectively
> >> hold on;
> >> plot(rand(10,1)) % add a new line, whose color is blue, i hope it can have red color.
>
> So my question is: how to continue the colororder property when adding a new line?
>
> Best Regards
> mayi
> 2010-07-21

Fom the Axes Properties help page:

ColorOrder
m-by-3 matrix of RGB values

Colors to use for multiline plots. ColorOrder is an m-by-3 matrix of RGB values that define the colors used by the plot and plot3 functions to color each line plotted. If you do not specify a line color with plot and plot3, these functions cycle through the ColorOrder to obtain the color for each line plotted. To obtain the current ColorOrder, which may be set during startup, get the property value:

get(gca,'ColorOrder')

Note that if the axes NextPlot property is set to replace (the default), high-level functions like plot reset the ColorOrder property before determining the colors to use. If you want MATLAB to use a ColorOrder that is different from the default, set NextPlot to replacechildren. You can also specify your own default ColorOrder.

Note the caveat in the last paragraph about NextPlot.
From: us on
"Mayi DA" <damayi(a)gmail.com> wrote in message <i25g43$pro$1(a)fred.mathworks.com>...
> Dear all
> ColorOrder is used for plot line color in axes. However, when add a new plot line to an exist axes, it will plot the line from the beginning ColorOrder. Here is an example:
> >> plot(rand(10,2)) % plot 2 lines in axes, which have blue and green color respectively
> >> hold on;
> >> plot(rand(10,1)) % add a new line, whose color is blue, i hope it can have red color.
>
> So my question is: how to continue the colororder property when adding a new line?
>
> Best Regards
> mayi
> 2010-07-21

a hint:
- do NOT use the quick-and-dirty PLOT...
- use LINE for serious graphics...

us
From: Mayi DA on
Dear,
I have read this help document, and I know the reason, in my opinion, I have to set all the line color by programming. I post my question , hope a more easy way can resolve my problem. Thanks anyway.

best regards
mayi

"someone" <someone(a)somewhere.net> wrote in message <i25i3s$2oi$1(a)fred.mathworks.com>...
> "Mayi DA" <damayi(a)gmail.com> wrote in message <i25g43$pro$1(a)fred.mathworks.com>...
> > Dear all
> > ColorOrder is used for plot line color in axes. However, when add a new plot line to an exist axes, it will plot the line from the beginning ColorOrder. Here is an example:
> > >> plot(rand(10,2)) % plot 2 lines in axes, which have blue and green color respectively
> > >> hold on;
> > >> plot(rand(10,1)) % add a new line, whose color is blue, i hope it can have red color.
> >
> > So my question is: how to continue the colororder property when adding a new line?
> >
> > Best Regards
> > mayi
> > 2010-07-21
>
> Fom the Axes Properties help page:
>
> ColorOrder
> m-by-3 matrix of RGB values
>
> Colors to use for multiline plots. ColorOrder is an m-by-3 matrix of RGB values that define the colors used by the plot and plot3 functions to color each line plotted. If you do not specify a line color with plot and plot3, these functions cycle through the ColorOrder to obtain the color for each line plotted. To obtain the current ColorOrder, which may be set during startup, get the property value:
>
> get(gca,'ColorOrder')
>
> Note that if the axes NextPlot property is set to replace (the default), high-level functions like plot reset the ColorOrder property before determining the colors to use. If you want MATLAB to use a ColorOrder that is different from the default, set NextPlot to replacechildren. You can also specify your own default ColorOrder.
>
> Note the caveat in the last paragraph about NextPlot.
From: Loren Shure on

"Mayi DA" <damayi(a)gmail.com> wrote in message
news:i25g43$pro$1(a)fred.mathworks.com...
> Dear all
> ColorOrder is used for plot line color in axes. However, when add a new
> plot line to an exist axes, it will plot the line from the beginning
> ColorOrder. Here is an example:
>>> plot(rand(10,2)) % plot 2 lines in axes, which have blue and green
>>> color respectively
>>> hold on;
>>> plot(rand(10,1)) % add a new line, whose color is blue, i hope it can
>>> have red color.
>
> So my question is: how to continue the colororder property when adding a
> new line?
>
> Best Regards
> mayi
> 2010-07-21

Instead of using hold on, use hold all

--
Loren
http://blogs.mathworks.com/loren/
http://matlabwiki.mathworks.com/MATLAB_FAQ