Prev: reformating and writing a char matrix to a file
Next: Nelder-mead Algorithm, Doubt on number of Parameters
From: John on 14 Jul 2010 17:35 Okay, I'm plotting data in a GUI on an AXES which is on a PANEL. 1) I plot the data to the axes handle (This works fine) 2) generate a new axes to overlay on top of the first axes and plot some more data When generating the second axes, I *think* i set the COLORORDER property for it by writing: set(data_axes(2), 'ColorOrder', rand(length(DataSet),3)) In the next line of code, I plot the data to the axes, but the color reverts back to the default ColorOrder (red, then green, then blue, ...). What gives? Do I need to specify before or after the plot command or should that even matter? (i've tried both) -John
From: Rich Ellis on 14 Jul 2010 18:20 High-level plotting functions reset many axes properties to their defaults. See "Setting Default Property Values" in the MATLAB documentation. Basically, you want to do something like this: set(get(data_axes(2),'Parent'),'DefaultAxesColorOrder',rand(length(DataSet),3)) That is, define a default value for the axes ColorOrder property on the parent (UIPanel) level. Or, you could use the line function to plot data: set(data_axes(2), 'ColorOrder', rand(length(DataSet),3)) line(x,y,z) "John " <jfishbac(a)gmail.com> wrote in message news:i1lai8$2lg$1(a)fred.mathworks.com... > Okay, > > I'm plotting data in a GUI on an AXES which is on a PANEL. > 1) I plot the data to the axes handle (This works fine) > 2) generate a new axes to overlay on top of the first axes and plot some > more data > > When generating the second axes, I *think* i set the COLORORDER property > for it by writing: > set(data_axes(2), 'ColorOrder', rand(length(DataSet),3)) > > In the next line of code, I plot the data to the axes, but the color > reverts back to the default ColorOrder (red, then green, then blue, ...). > > What gives? Do I need to specify before or after the plot command or > should that even matter? (i've tried both) > > -John >
From: Michael on 14 Jul 2010 19:01 % YOU NEED "HOLD ALL" figure; h(1)=subplot(1,2,1); plot(rand(5)); h(2)=subplot(1,2,2); set(h(2), 'ColorOrder', repmat([1 0 0; 0 1 0],3,1)); hold all; plot(rand(5)); pause(1); set(h(2),'Position',get(h(1),'Position'),'Color','none');
From: Pekka Kumpulainen on 15 Jul 2010 03:55
"John " <jfishbac(a)gmail.com> wrote in message <i1lai8$2lg$1(a)fred.mathworks.com>... > Okay, > > I'm plotting data in a GUI on an AXES which is on a PANEL. > 1) I plot the data to the axes handle (This works fine) > 2) generate a new axes to overlay on top of the first axes and plot some more data > > When generating the second axes, I *think* i set the COLORORDER property for it by writing: > set(data_axes(2), 'ColorOrder', rand(length(DataSet),3)) > > In the next line of code, I plot the data to the axes, but the color reverts back to the default ColorOrder (red, then green, then blue, ...). > > What gives? Do I need to specify before or after the plot command or should that even matter? (i've tried both) > > -John Plot will reset the ColorOrder property by default. Yet another way to deal with that: Set the NextPlot property of the axes to replacechildren that will prevent higher level plot from resetting all the properties. set(data_axes(2),'NextPlot','replacechildren') |