Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!p36g2000prn.googlegroups.com!not-for-mail
From: Nathan <ngreco32@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: labeling bar graphs ?
Date: Thu, 2 Jul 2009 16:18:53 -0700 (PDT)
Organization: http://groups.google.com
Lines: 22
Message-ID: <d0209b81-628c-4366-958e-cc482c785e04@p36g2000prn.googlegroups.com>
References: <h2jauf$plk$1@fred.mathworks.com>
NNTP-Posting-Host: 198.206.219.34
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1246576733 14170 127.0.0.1 (2 Jul 2009 23:18:53 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 2 Jul 2009 23:18:53 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p36g2000prn.googlegroups.com; posting-host=198.206.219.34; 
	posting-account=_KeVcAoAAAB7j3xn35ujaQ0BoQhuzwJP
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) 
	Gecko/20090624 Firefox/3.5,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 wwwproxy-son-ca-02.ca.sandia.gov:80 (squid/2.5.STABLE14)
Bytes: 2019
Xref: news.mathworks.com comp.soft-sys.matlab:552577


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