Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: all axis tick labels with the same digits
Date: Thu, 30 Jul 2009 15:39:01 +0000 (UTC)
Organization: Naval Meteorology &#38; Oceanography Command
Lines: 31
Message-ID: <h4seql$g81$1@fred.mathworks.com>
References: <h4p9q8$bcu$1@fred.mathworks.com> <h4patp$mu3$1@fred.mathworks.com> <h4pdki$e5b$1@fred.mathworks.com> <h4pith$kl4$1@fred.mathworks.com> <h4rv7t$mlk$1@fred.mathworks.com> <h4scpu$4fh$1@news.eternal-september.org>
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 1248968341 16641 172.30.248.35 (30 Jul 2009 15:39:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 30 Jul 2009 15:39:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 185640
Xref: news.mathworks.com comp.soft-sys.matlab:559673


dpb <none@non.net> wrote in message <h4scpu$4fh$1@news.eternal-september.org>...
> pietro wrote:
> ...
> >> Since I'm guessing you're objecting to the manual way Wayne constructed the 
> >> tick label cell array, you can automate the formatting of the labels if the 
> >> format you want is possible using the formatting specification in SPRINTF:
> ...
> > thank you very much, i was finding that.
> 
> I still think should submit enhancement request.  When I've made such 
> submittals w/o a currently supported license they've pretty much gotten 
> the brush off afaict...
> 
> --

I agree that this is a feature I've always wanted.  Manually setting labels is a huge pain, especially if you plan to zoom, pan, change axis limits, etc.  I've written a function, tick2text, that allows you to assign a formatting string to ticks (and to do more slightly complicated formatting, like adding TeX strings) by changing them to text objects: 

http://www.mathworks.com/matlabcentral/fileexchange/16003

However, this method is a bit limited in that I find myself having to work around manual changes to the axis.  For example:

plot(rand(1,5));
tick2text(gca, 'xformat', '%.2f');
set(gca, 'xlim', [0 10]); % Ticks are wrong
zoom(1); % Now ticks are good again

Also, as I have it written write now, you have to fudge around with the buffer variables to figure out where ticks should be located with respect to your axes if you're using subplots.

Having built-in support for formatting would be very nice.

-Kelly