MATLAB: How to show the major grid lines as solid and the minor grid lines as dotted


I would like to set the major grid lines to have a solid linestyle, and the minor gridlines to have a dashed/dotted linestyle.

Best Answer

  • In order to change the style of the major gridlines, use the SET command as in the following example:
    grid minor
    This example will draw the major grid lines and change their style to solid (using the SET command for the axes GridLineStyle property) and then draw the minor grid lines without changing their linestyle.