Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!news.glorb.com!news.aset.psu.edu!not-for-mail
From: dvt <dvt+usenet@psu.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: label points
Date: Sat, 09 Feb 2008 16:36:51 -0500
Organization: Penn State University, Center for Academic Computing
Lines: 24
Message-ID: <fol6dm$mts$1@f04n12.cac.psu.edu>
References: <fokus2$c5h$1@fred.mathworks.com> <fol08h$l7n$1@canopus.cc.umanitoba.ca> <fol251$qdg$1@fred.mathworks.com>
NNTP-Posting-Host: vpn2-1-19.cac.psu.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: f04n12.cac.psu.edu 1202593016 23484 172.25.1.19 (9 Feb 2008 21:36:56 GMT)
X-Complaints-To: usenet@f04n12.cac.psu.edu
NNTP-Posting-Date: Sat, 9 Feb 2008 21:36:56 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
In-Reply-To: <fol251$qdg$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:450368



 >> Steve  <steveDEL.bachmeierDEL@yahoo.com> wrote:
 >>> Is it possible to label only specific values when using
 >>> plot() in Matlab?  i.e. I have many data points but want
 >>> only the maximums and minimums labeled with (x,y_max).

Steve wrote:
> Sorry, let me clarify.  The axes are fine, but I'd like to
> add markers to specific values (not at each data point).  In
> addition, if possible, I'd like to have the (x,y)
> coordinates at each of these points of interest labeled
> right on the plot.  Thanks!

Try something like this:

% sample data; you already have x and y plotted
x = rand(10,1);
y = rand(10,1);
plot(x,y,'o')

% this labels the data point(s) with the largest x and y values
% these labels might overlap if one data point has the maximum x and y
% of the set
text(max(x),y(x==max(x)),' \leftarrow max x')
text(x(y==max(y)),max(y),' \leftarrow max y')