help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting, hold-on, colors


From: Ben Boxman
Subject: Re: Plotting, hold-on, colors
Date: Tue, 2 Sep 2008 05:02:29 -0700 (PDT)


  Setting colors manually works if you are dealing with a "simple" plot
(though this is somewhat annoying). This becomes a bit more "icky" if you're
using other functions that end up calling plot (for instance: hist, pwelch,
or a user function) -- there is a work-around (in that you can receive the
raw plot data, and then call plot (or bar), rewrite said user function to
set a color externally (in lieu of the default color)), but this requires
multiple steps + setting colors for each and every one.
  (e.g. two hists() with hold on also aren't satisfactory)

  My primary reason for using octave is convenience --  I can both process &
visualize my data (which is often produced by a non-octave environment) --
and I can do both in a simple/efficient manner -- which I can't do, as
easily, outside of octave.

Ben



Ben Abbott wrote:
> 
> 
> On Sep 2, 2008, at 2:54 AM, Ben Boxman wrote:
> 
>>
>> Hi,
>>
>>  I tried "set (gca, 'colororder', colors)", but what this seems to  
>> allow me
>> is to change the order of the colors as used by plot (e.g. changing  
>> the
>> second used color from green to red). This is isn't my problem --  
>> I'm having
>> a problem with "hold on".
>>
>>  My problem is not the actual colors in the color order, but that  
>> toggling
>> "hold on" will keep the same color. For instance, if I do the  
>> following:
>> x = [1:100]
>> plot(x, sin(x), x, cos(y))
>> I get a graph with sin(x) showing up with one color, and cos(y)  
>> showing up
>> with another (for some reason, blue and green).
>>
>> However, if I do:
>> hold off;
>> plot(x, sin(x))
>> hold on;
>> plot(x, sin(y))
>> I get a graph with sin(x) and cos(x) sharing the same color (blue).
>>
>> This used to work properly in the old octave chain (i.e. 2.1.x) and  
>> seems to
>> be broken at least from 2.9.x.
>>
>> I want to use hold. It is inconvenient to:
>> 1) Set colors manually for each plot.
>> or:
>> 2) Pass these all off as one plot.
>> And -- if I'm using another function that produces a plot (e.g.  
>> hist, or
>> pwelch, or perhaps even one of my own) -- which I wish to  
>> superimpose on
>> another, it can get even more difficult.
>>
>>
>> Many thanks,
>>
>> Ben Boxman
> 
> is the following to much trouble?
> 
>       hold off
>       plot (x, sin(x), 'b')
>       hold on
>       plot (x, cos(x), 'r')
> 
> Ben
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Plotting%2C-hold-on%2C-colors-tp19256790p19268873.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]