grid
Display or hide axes grid lines
Description
grid on
displays the major grid lines for the current axes returned by
the gca
command. Major grid lines extend from each tick
mark.
grid off
removes all grid lines from the current axes or chart.
grid
toggles the visibility of the major
grid lines.
grid minor
toggles the visibility of the minor grid lines. Minor grid
lines lie between the tick marks. Not all types of charts support minor grid
lines.
grid(
displays or hides
the grid by specifying a visibility
)visibility
value. You can specify
visibility
as "on"
,
"off"
, a logical value, or an
OnOffSwitchState
value.
Examples
Input Arguments
Tips
When working with Cartesian axes, some axes properties affect the appearance of the grid lines. This table lists a subset of axes properties related to the grid lines.
Axes Property Description XTick
,YTick
,ZTick
Location of tick marks and major grid lines for each axis direction XGrid
,YGrid
,ZGrid
Display of major grid lines for each axis direction XMinorGrid
,YMinorGrid
,ZMinorGrid
Display of minor grid lines for each axis direction LineWidth
Line width of grid lines, axes box outline, and tick marks GridLineStyle
Major grid line style MinorGridLineStyle
Minor grid line style GridColor
Major grid line color MinorGridColor
Minor grid line color GridAlpha
Major grid line transparency MinorGridAlpha
Minor grid line transparency Layer
Location of grid lines in relation to the plotted data When working with polar axes, some polar axes properties affect the appearance of the grid lines. This table lists a subset of polar axes properties related to the grid lines.
PolarAxes Property Description ThetaTick
,RTick
Location of tick marks and major grid lines for each axis direction ThetaGrid
,RGrid
Display of major grid lines for each axis direction ThetaMinorGrid
,RMinorGrid
Display of minor grid lines for each axis direction LineWidth
Width of outline, tick marks, and grid lines GridLineStyle
Major grid line style MinorGridLineStyle
Minor grid line style GridColor
Major grid line color MinorGridColor
Minor grid line color GridAlpha
Major grid line transparency MinorGridAlpha
Minor grid line transparency Layer
Location of grid lines in relation to the plotted data
When working with geographic axes, some geographic axes properties affect the appearance of the grid lines. This table lists a subset of geographic axes properties related to the grid lines. Note that
GeographicAxes
objects do not support minor grid lines.GeographicAxes Property Description Grid
Display of latitude and longitude grid lines LineWidth
Line width of grid lines, box outline, and tick marks GridLineStyle
Grid line style GridColor
Color of grid lines GridAlpha
Grid line transparency
Algorithms
The grid
function sets these graphics object
properties to either 'on'
or 'off'
: