Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: labeling bar graphs ?
Date: Fri, 3 Jul 2009 20:29:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <h2lpme$ds2$1@fred.mathworks.com>
References: <h2jauf$plk$1@fred.mathworks.com> <d0209b81-628c-4366-958e-cc482c785e04@p36g2000prn.googlegroups.com>
Reply-To: <HIDDEN>
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 1246652942 14210 172.30.248.35 (3 Jul 2009 20:29:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 3 Jul 2009 20:29:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1646679
Xref: news.mathworks.com comp.soft-sys.matlab:552723


I knew how to do that, although not so elegantly!
But I actually meant to have the labels on the graph itself, which I think the only way to do is manually .. although I hope there is a way!

Nathan <ngreco32@gmail.com> wrote in message <d0209b81-628c-4366-958e-cc482c785e04@p36g2000prn.googlegroups.com>...
> On Jul 2, 3:05?pm, "Juliette Salexa" <juliette.physic...@gmail.com>
> wrote:
> > If I have an array of values called A,
> > and I apply the command bar(A), I get a bunch of rectangles showing me the contents of A. ?
> >
> > Say I had another array B, who's elements were strings which I intend to use to label each of the the rectangles corresponding to the elements of A. ?How can I get these strings to show up as labels for the rectangles in the bar graph, from the command line ??
> > it should only be one command .. I shouldn't have to add them manually.
> 
> well...
> How about
> A = rand(5,1);
> B = {'One';'Two';'Three';'Four';'Five'};
> bar(A);
> set(gca,'XTickLabel',B);
> 
> (The set(gca,'XTickLabel',label) is your "one command")
> I hope that's what you were looking for...
> -Nathan