This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

GridLines

GridLines
is an option for two-dimensional graphics functions that specifies grid lines.
  • The following settings can be given for GridLines:
Noneno grid lines drawn
Automaticgrid lines placed automatically
{xgrid,ygrid}grid lines specified separately in each direction
  • With the Automatic setting, grid lines are usually placed at points whose coordinates have the minimum number of digits in their decimal representation.
  • For each direction, the following grid line options can be given:
Noneno grid lines drawn
Automaticgrid line positions chosen automatically
{x1,x2,...}grid lines drawn at the specified positions
{{x1,style1},...}grid lines with specified styles
funca function to be applied to , to get the grid line option
  • Grid line styles can involve any graphics directives, such as RGBColor and Thickness.
  • The grid line function may return any other grid line option.
Put grids across a 2D graphic:
Draw grid lines at the specific positions:
Specify grid styles:
Specify overall grid lines style using GridLinesStyle:
Put grids across a 2D graphic:
In[1]:=
Click for copyable input
Out[1]=
 
Draw grid lines at the specific positions:
In[1]:=
Click for copyable input
Out[1]=
 
Specify grid styles:
In[1]:=
Click for copyable input
Out[1]=
 
Specify overall grid lines style using GridLinesStyle:
In[1]:=
Click for copyable input
Out[1]=
Place the grids automatically:
Place the grids in the direction:
Place the grids in the direction:
Draw grid lines at specific positions:
Specify the style of each grid line:
Specify overall grid lines style using GridLinesStyle:
Individually styled grid lines can be used with GridLinesStyle and have higher priority:
Specify a grid function applied to and values of each direction:
Put a solid line at each integer, and a dashed line in between:
Emulate graph paper:
Grid lines on all the integer values:
Grid lines are placed on the major ticks by default:
Grid lines are always drawn below all the graphics:
Mesh and MeshFunctions can be used to draw lines on top of a certain plot:
In some plots, grid lines can be completely occluded by the image:
Mesh can be used instead to place the lines above the graphic:
A random collection of grid lines:
New in 2