Path: news.mathworks.com!not-for-mail
From: "Jeff " <jea@gene.dot.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Color / 3D plots
Date: Wed, 22 Jun 2011 19:17:20 +0000 (UTC)
Organization: Genentech Inc
Lines: 68
Message-ID: <ittf40$ktr$1@newscl01ah.mathworks.com>
References: <itr1d6$k7h$1@newscl01ah.mathworks.com> <itr2qo$o1r$1@newscl01ah.mathworks.com> <itr4sc$i$1@newscl01ah.mathworks.com> <itro83$h0v$1@newscl01ah.mathworks.com> <ittd1q$ee9$1@newscl01ah.mathworks.com>
Reply-To: "Jeff " <jea@gene.dot.com>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1308770240 21435 172.30.248.45 (22 Jun 2011 19:17:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 22 Jun 2011 19:17:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1423763
Xref: news.mathworks.com comp.soft-sys.matlab:733278

"Paul " <palex71@hotmail.com> wrote in message <ittd1q$ee9$1@newscl01ah.mathworks.com>...
> "Steven_Lord" <slord@mathworks.com> wrote in message <itro83$h0v$1@newscl01ah.mathworks.com>...
> > 
> > 
> > "Paul " <palex71@hotmail.com> wrote in message 
> > news:itr4sc$i$1@newscl01ah.mathworks.com...
> > > "Jeff " <jea@gene.dot.com> wrote in message 
> > > <itr2qo$o1r$1@newscl01ah.mathworks.com>...
> > >> "Paul " <palex71@hotmail.com> wrote in message 
> > >> <itr1d6$k7h$1@newscl01ah.mathworks.com>...
> > >> > Hello,
> > >> > This should be farily easy...
> > >> > I have a 1000x3 matrix.  I am looking to do a color plot, where column 
> > >> > #1 defines the x axis, column #2 defines the y axis, and column #3 is 
> > >> > the color.
> > >> >
> > >> > I would also be interested in knowing how to do a 3D plot with the same 
> > >> > matrix.
> > >> >
> > >> > I haven't quite been able to figure out the proper command/syntax.
> > >> >
> > >> > Thanks!
> > >>
> > >> Can you give an example of your data, and a bit more description on what 
> > >> you want your plot to look like?  Specifically, how are you representing 
> > >> color in a single column.
> > >
> > > For the color plot, I was looking for:
> > > Column 1 - x axis
> > > Column 2 - y axis
> > > Column 3 - color point (higher value = darker color)
> > >
> > > Good point... How would I do a plot3 with an increasing color variation 
> > > with depth?
> > 
> > HELP SCATTER3
> > 
> > -- 
> > Steve Lord
> > slord@mathworks.com
> > To contact Technical Support use the Contact Us link on 
> > http://www.mathworks.com 
> 
> Thanks for the replies.
> Here is a better indication on what I am trying to do with a 2d plot:
> 
> Matrix:
> 1 2 6
> 3 5 4
> 8 9 5
> 
> I need the x axis (column #1) scaled from 1 to 8
> I need the y axis (column #2) scaled from 2 to 9
> At (x,y) = (1,2), I need a point plotted of color value = 6 (darkest)
> At (x,y) = (3,5), I need a point plotted of color value = 4 (lightest)
> At (x,y) = (8,9), I need a point plotted of color value = 5 (middle)
> 
> Thanks again!

Give the following a try:

matin = [ 1 2 6; 3 5 4 ; 8 9 5; 4 4 10 ; 2 2 3];

scatter(matin(:,1), matin(:, 2), 100, matin(:,3), 'filled')
axis([0 10 0 10])
colormap(cool)

Check out the help section for colormap for a list of default maps, or to create your own.  I scaled the axis a bit larger than the min/max for x and y, as one of the points was being clipped.  You could remove this entirely, or use an expression like (min(matin(:,1) -1) to automatically scale this.