Path: news.mathworks.com!not-for-mail
From: "Belen " <ahsghd@hjg.es>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Axes ticks irregular spacing
Date: Mon, 29 Jun 2009 13:23:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <h2af7l$58p$1@fred.mathworks.com>
References: <h2a9ut$dmc$1@fred.mathworks.com> <h2aeku$pld$1@fred.mathworks.com>
Reply-To: "Belen " <ahsghd@hjg.es>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246281781 5401 172.30.248.37 (29 Jun 2009 13:23:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Jun 2009 13:23:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1890883
Xref: news.mathworks.com comp.soft-sys.matlab:551401


Thank you very much Steven. We are all used to program here in my office, but my  none of us knew how to do this simple irregular spacing. 
Best whishes,
Belen


"Steven Lord" <slord@mathworks.com> wrote in message <h2aeku$pld$1@fred.mathworks.com>...
> 
> "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 
>