The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: I have n graphs and I want different color
Replies: 13   Last Post: Nov 9, 2012 2:41 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Barry Williams

Posts: 312
Registered: 6/14/06
Re: I have n graphs and I want different color
Posted: Nov 9, 2012 10:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Steven_Lord" <> wrote in message <k7j4ul$nop$>...
> "Nasser M. Abbasi" <> wrote in message
> news:k7imno$df1$

> > On 11/9/2012 4:29 AM, Nasser M. Abbasi wrote:
> >> On 11/9/2012 4:16 AM, Debora wrote:
> *snip*

>> *snip*
When I have to plot spectra, for example, that show an increase in response over time, I use a small program that I wrote to generate an array of colors that go from *cool* blue to *warm* red.

function Colors = plot_colors(no_plots)
% Generates an n X 3 array of rgb values for multiple plots.
% The colors trend from *coolor* blue to *warmer* red.
% This is useful for showing an increase in response over time.
% Can be used in a loop. Example:
% for n=1:no_plots
% plot(x(n), y(n), 'Color', Colors(n,:))
% end
Colors = zeros(no_plots,3);
Colors(:,1) = linspace(0,1,no_plots);
Colors(:,3) = linspace(1,0,no_plots);
half = round(no_plots/2);

I have found it useful for easily visualizing trends in the data where there are a maximum of about 20 plots.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.