Path: news.mathworks.com!not-for-mail
From: "Eric Brown" <eric.t.brown@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Varying point-to-point line color in plot
Date: Wed, 25 Mar 2009 18:09:02 +0000 (UTC)
Organization: University of Rochester
Lines: 5
Message-ID: <gqdrvu$2nf$1@fred.mathworks.com>
Reply-To: "Eric Brown" <eric.t.brown@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1238004542 2799 172.30.248.35 (25 Mar 2009 18:09:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 25 Mar 2009 18:09:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 570589
Xref: news.mathworks.com comp.soft-sys.matlab:527689


I would like to add timing information to a plot with X and Y data by varying the color of the line from 1:length(X). I attempted to do this with meshgrid and mesh, but the results were not informative.

Is there an easy way to vary the point by point color of a line?

I can see how to do this using 'hold' and plotting individual segments within a loop, but it seems like there should be a better way.