Thread Subject: how to assign different colors to different data points?

Subject: how to assign different colors to different data points?

From: Zijia Li

Date: 9 Jul, 2008 14:18:02

Message: 1 of 3

I have a contour graph of Lake Michigan Water Temperature of
different Depth and different time of the year. So on the
x-axis is Dates and Times for a whole year. Y-axis is
depth(on top is 0m and bottom is 140m). The whole contour
graph is colors from blue to red indicating temperature with
a colorbar on the side.

The problem is that I'm making the same contour graph for
different years. So the automatic color assigned to the
temperature data is different for each year. So for example,
the 0 degrees on the color bar for 2007 is at the darkest
blue, while 0 degrees on the color bar for 2006 is at a much
lighter blue.

How do I retrieve the color assigned to the temperature data
in 2007 and apply it to 2006's contour graph?

Any comment and help is appreciated.
By the way I am using matlab 5.3 right now, but newer
version solutions are welcome too.
Thanks

Subject: how to assign different colors to different data points?

From: Zijia Li

Date: 9 Jul, 2008 15:24:02

Message: 2 of 3

Also there should be a matrix that matches the color numbers
with the temperature data right?
If I can copy that matrix from 2007 into 2006 contour graph
then it will work right?
I tried retrieving the colormap from 2007 graph and saved it
as "map" and in the 2006 M-file I set colormap(map), but the
colors stayed the same
Or is it that the colorbar keeps this data?
Any help?

Subject: how to assign different colors to different data points?

From: Peter Boettcher

Date: 9 Jul, 2008 16:32:06

Message: 3 of 3

"Zijia Li" <triplezzz21@gmail.com> writes:

> I have a contour graph of Lake Michigan Water Temperature of
> different Depth and different time of the year. So on the
> x-axis is Dates and Times for a whole year. Y-axis is
> depth(on top is 0m and bottom is 140m). The whole contour
> graph is colors from blue to red indicating temperature with
> a colorbar on the side.
>
> The problem is that I'm making the same contour graph for
> different years. So the automatic color assigned to the
> temperature data is different for each year. So for example,
> the 0 degrees on the color bar for 2007 is at the darkest
> blue, while 0 degrees on the color bar for 2006 is at a much
> lighter blue.
>
> How do I retrieve the color assigned to the temperature data
> in 2007 and apply it to 2006's contour graph?
>
> Any comment and help is appreciated.
> By the way I am using matlab 5.3 right now, but newer
> version solutions are welcome too.

"contour" tries to figure out at which temperatures it should draw
contours. If the datasets are different, it will choose different
temperatures for each dataset, leading to different colors for each
dataset.

"help contour" (at least on my new version of MATLAB) shows:

CONTOUR(Z,V) and CONTOUR(X,Y,Z,V) draw LENGTH(V) contour lines
    at the values specified in vector V.

So if you input the same vector of temperatures into each contour call,
you should get the same colors, and even lines at the same fixed
temperatures. Maybe -20:5:40 or something.

-Peter

Tags for this Thread

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

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 Terms prior to use.

Contact us at files@mathworks.com