Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Axes ticks irregular spacing
Date: Mon, 29 Jun 2009 09:13:46 -0400
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <h2aeku$pld$1@fred.mathworks.com>
References: <h2a9ut$dmc$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1246281182 26285 144.212.105.187 (29 Jun 2009 13:13:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Jun 2009 13:13:02 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:551396



"dage Tarari" <ahsghd@hjg.es> wrote in message 
news:h2a9ut$dmc$1@fred.mathworks.com...
> Hi all,
>
> I wonder if it is possible to create X axis ticks with non-monotonically 
> increasing values. Example: if the x-axis represents time and we want to 
> locate one tick for the first day of every month, the spacing will be 28 
> and 31 between 01 Feb, 01 Mar and 01 Apr, respectively.

Others have suggested setting the XTick and/or XTickLabel properties, but 
from your description I think you may prefer using the DATETICK function in 
addition.

x = datenum(2009, 1:12, 1);
y = (1:length(x)).^2;
plot(x, y);
set(gca, 'XTick', x)
datetick('x', 6)

% alternately, if you want all the first days labeled, replace the last line 
above with:
datetick('x', 6, 'keepticks')

-- 
Steve Lord
slord@mathworks.com