logo

How to Remove Tick Guides in MATLAB Plots 📂Programing

How to Remove Tick Guides in MATLAB Plots

Code

>> scatter(rand(10, 1), rand(10, 1))

alt text

To completely remove the ticks themselves, you can use xtick([]) or ytick([]). However, if you want to remove just the tick guides while keeping the values, you need to adjust the TickLength as shown below1.

>> set(gca, 'TickLength', [0, 0])

alt text

This trick involves setting the length of the tick guides to zero. According to other documentation, in [x y], x represents the length of the tick guides on the x-axis and y represents the length on the y-axis. However, at least in version 2023b, I discovered a bug where x controls both the x and y axes simultaneously, and y has no function.

Environment

  • OS: Windows
  • MATLAB: 2023b