is an option for two-dimensional graphics functions that specifies grid lines.
GridLines
is an option for two-dimensional graphics functions that specifies grid lines.
Details
- The following settings can be given for GridLines :
-
None no grid lines drawnAutomatic grid 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:
-
None no grid lines drawnAutomatic grid line positions chosen automatically{x1,x2,…} grid lines drawn at the specified positions{{x1,style1},…} grid lines with specified stylesfunc a function to be applied to xmin, xmax to get the grid line option
- Grid line styles can involve any graphics directives, such as RGBColor and Thickness .
- The grid line function func[xmin,xmax] may return any other grid line option.
- AbsoluteOptions gives the explicit form of GridLines specifications when Automatic settings are used.
- GridLinesStyle gives default styles to use for grid lines.
Examples
open all close allBasic Examples (4)
Put grids across a 2D graphic:
Draw grid lines at the specific positions:
Specify grid styles:
Specify overall grid lines style using GridLinesStyle :
Scope (6)
GridLines Positions (3)
Place the grids automatically:
Place the grids in the direction:
Place the grids in the direction:
Draw grid lines at specific positions:
GridLines Styling (3)
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:
Generalizations & Extensions (1)
Specify a grid function applied to xmin and xmax values of each direction:
Applications (3)
Put a solid line at each integer, and a dashed line in between:
Emulate graph paper:
Grid lines on all the integer values:
Properties & Relations (3)
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:
Possible Issues (1)
In some plots, grid lines can be completely occluded by the image:
Mesh can be used instead to place the lines above the graphic:
Neat Examples (1)
A random collection of grid lines:
See Also
Ticks FrameTicks FaceGrids Frame GridLinesStyle Axes MeshFunctions PolarGridLines
Function Repository: GraphPaperGridLines
Tech Notes
Related Guides
History
Introduced in 1991 (2.0) | Updated in 2007 (6.0)
Text
Wolfram Research (1991), GridLines, Wolfram Language function, https://reference.wolfram.com/language/ref/GridLines.html (updated 2007).
CMS
Wolfram Language. 1991. "GridLines." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/GridLines.html.
APA
Wolfram Language. (1991). GridLines. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GridLines.html
BibTeX
@misc{reference.wolfram_2025_gridlines, author="Wolfram Research", title="{GridLines}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/GridLines.html}", note=[Accessed: 17-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_gridlines, organization={Wolfram Research}, title={GridLines}, year={2007}, url={https://reference.wolfram.com/language/ref/GridLines.html}, note=[Accessed: 17-November-2025]}