How to change the x ticket lables in a plot?

T
tanishka · Sep 7, 2020 · 1.9K views
Question
Hi, I have : x=1:12 %the index of months y = x. ^ 2; plot(x,y) No I want to change the position of x labels from below the tickets to the middle of interval (between every 2 tickets).
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 22, 2026
   x=1:12 %the index of months
   y = x. ^ 2;
   plot(x,y)
   set(gca,'xtick',[ 1 3 5 7 9 11])  % use whatever you want
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!