Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed2.funet.fi!newsfeeds.funet.fi!ousrvr3.oulu.fi!not-for-mail
From: marky <no@email.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: X axis format in R2007b
Date: Thu, 31 Jan 2008 15:42:34 +0200
Organization: "University of Oulu"
Lines: 23
Message-ID: <fnsj48$kul$1@news.oulu.fi>
References: <fnsdfi$ita$1@fred.mathworks.com>
NNTP-Posting-Host: mat088092.oulu.fi
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.oulu.fi 1201786824 21461 130.231.88.92 (31 Jan 2008 13:40:24 GMT)
X-Complaints-To: news@news.oulu.fi
NNTP-Posting-Date: Thu, 31 Jan 2008 13:40:24 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
In-Reply-To: <fnsdfi$ita$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:448536



Anish Goorah wrote:
> I have a year vector which runs from [19974:20064] and i
> plot it with another return vector with the following command:
> 
> plot(year,return)
> 
> It works fine except that when it is displaying the plot it
> shows the numbers in standard form on teh x-axis, i.e. it
> shows 1.97*10^4, 1.98*10^4 etc. How do i just switch it back
> to 19974 as to mean Q4 in 1997? It's the first time I have
> had this issue in matlab....

See the XTickLabel property of an axis. E.g.

x = 1:16;
l = repmat(1997:2000,4,1);
l = num2str(l(:));
l2 = repmat(['Q1';'Q2';'Q3';'Q4'],4,1);
ll = [l,l2];
y = sin(x);
plot(x,y,'.')
set(gca,'XTickLabel',ll)
set(gca,'XTick',x)