×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Matlab question: Xtick and Xticklabel handeling.

Matlab question: Xtick and Xticklabel handeling.

Matlab question: Xtick and Xticklabel handeling.

(OP)
My question is very simple: How to put the "XtickLabels" (for example months: Jan, Feb, Mar, etc.) in between two "Xticks"! (using "grid on" for the "Xticks"). That is, put the xlabels in diferent position than the xticks.

For example, if we have a time series of 365 values, I would like to obtain a plot with "13 Xticks" and "12 Xticklables": each Xticklabel should be in between two Xticks (for example the Xticklabel "January" should be in between the Xtick "1" and the Xtick "31"). I've tried with:

%========================================
close all
clear all

monthlim=[1,31,59,90,120,151,181,212,243,273,304,334,365]; %13 Xticks.
xticklabels=['J';'F';'M';'A';'M';'J';'J';'A';'S';'O';'N';'D']; %12 XtickLabels.

y=rand(1,365);
plot([1:365],y)
set(gca,'Xlim',[1,365],'XTick',monthlim,'XTicklabel',xticklabels)
grid on
%========================================

...But this can never work since I am using the same position for the "Xticks" and for the "Xticklabels".

Anybody know how to resolve this problem?.

I would realy apreciate any help or sugestion.

Than you for your time!

Serval.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources