Thread Subject: Plot 2D matrix with color gradient

Subject: Plot 2D matrix with color gradient

From: Jeff

Date: 14 Nov, 2007 16:21:32

Message: 1 of 2

Is it possible to plot a matrix with plot() that uses a color gradient to distinguish
between results?

I have a matrix of 200 columns x 300 rows where each column is a separate
simulation run and each row is a timepoint. This matrix is sorted by the sum of
each column where the least sums are first.

If I use plot(results_matrix) I get a 2d plot with 200 blue lines. I'd like to
generate a plot where the line from the first sorted column is blue and the last
sorted column is red. The lines in between use a color gradient between blue
and red just like the mesh() colorbar.

Any ideas?


Thanks!!

Subject: Plot 2D matrix with color gradient

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 14 Nov, 2007 17:36:55

Message: 2 of 2

In article <fhf7ac$epg$1@fred.mathworks.com>,
Jeff <jkear_REMOVE_ns@ucsd.edu> wrote:
>Is it possible to plot a matrix with plot() that uses a color gradient
>to distinguish between results?

>If I use plot(results_matrix) I get a 2d plot with 200 blue lines. I'd like to
>generate a plot where the line from the first sorted column is blue and the last
>sorted column is red. The lines in between use a color gradient between blue
>and red just like the mesh() colorbar.

This might help:

  doc plot

  Cycling Through Line Colors and Styles

  If you do not specify a color when plotting more than one line, plot
  automatically cycles through the colors in the order specified by the
  current axes ColorOrder property.
--
   "Okay, buzzwords only. Two syllables, tops." -- Laurie Anderson

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
plot Jeff 14 Nov, 2007 11:25:06
colorbar Jeff 14 Nov, 2007 11:25:06
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com