How to Adjust Axes in MATLAB

Written by michael peter
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Adjust Axes in MATLAB
The plot axes scale and label the data and can be modified in MATLAB. (BananaStock/BananaStock/Getty Images)

MATLAB is technical computing software used by scientists and engineers for processing and analysing data stored in arrays and matrices. Plotting the data assists in visualising the data after the appropriate calculations are performed. Frequently, it is necessary to change the plot properties and appearance to support the data. The axes of the plot show the scale of the graph using tick marks and labels, which are used to match the plot line with its value. You can change the axes on a MATLAB plot, including the limits of each axis, the location and frequency of the tick marks, and the font labels' colour and weight.

Skill level:
Moderately Easy


  1. 1

    Clear all active variables within the workspace by entering "clear all" in the MATLAB Command window.

  2. 2

    Create sample data to plot. Input "x=1:1:50;" and "y=rand(1,50);" in the Command window. This creates a 50-element array for "x," starting at 1 and ending at 50, and a 50-element array of random numbers for "y."

  3. 3

    Plot the sample data created in Step 3 by inputting "plot(x,y)" in the Command window. A new window appears labelled Figure 1, showing the sample data using a solid line.

  4. 4

    Change the x-limits and y-limits of the plot by modifying the command used in Step 3 by entering "plot(x,y); xlim([1 55])", which changes the limits of the x-axis from 50 to 55. Use the command "ylim" to change the y-axis limits.

  5. 5

    Change additional axis properties by clicking on "Show Plot Tools and Dock Figure" from the Figure menu. Click anywhere on the plot. Under the "X-Axis" tab, add in the axes labels and change the axes limits. Click on the "Ticks" button to change the axes scales and tick mark locations. Change the y-axis properties by clicking on the "Y-Axis" tab. Change the font of the axes labels by clicking on the "Font" tab.

Tips and warnings

  • All properties mentioned in Step 5 can be incorporated into the Command window, reducing the need to detail each individual plot. Refer to the appropriate MATLAB documentation for additional commands.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.