The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: x-axis has too many tick lables
Replies: 5   Last Post: Aug 29, 2013 9:38 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 9,850
Registered: 6/7/07
Re: x-axis has too many tick lables
Posted: Aug 28, 2013 2:59 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 8/28/2013 1:54 PM, dpb wrote:
> On 8/28/2013 1:47 PM, Larry Rose wrote:
>> hello,
>> Does someone know a command to limit the number of x-axis tick labels?
>> So, could limit the number of labels to a specific number of labels. I
>> have too many so I can't even read them unless I enlarge the graph.
>> please advise.

> Not specifically a command, no...use the 'xtick' and/or 'xticklabel'
> properties to set the number/values.
> To cut them in half, for example,
> xt=get(gca,'xtick'); % get the current ones
> xt(1:2:end)=[]; % wipe out every other one
> set(gca,'xtick',xt) % and replace w/ updated
> Innumerable variations upon a theme are possible, of course...

Dang--hit 'return' instead before updating the above...better choice for
the above would be to keep the first instead of second so

xt(2:2:end)=[]; % wipe out every other one

and, of course, you can also do things like

xt=linspace(xt(1),xt(end),N); % to pick a given number

Often you'll want to make the spacing pretty of course, so a little
logic for that is always in order. But, the general idea is
straightforward; specifics depend on the case.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.