Gridlines may be placed on a plot and subsequently removed via the statements:
set grid set nogrid
respectively. The following commands are also valid:
unset grid unset nogrid
By default, gridlines are drawn from the major and minor ticks of the default horizontal and vertical axes (which are the first axes in each direction unless set otherwise in the configuration file; see Chapter 19). However, the axes which should be used may be specified after the set grid command:
set grid x2y2 set grid x x2y2
The top example would connect the gridlines to the ticks of the x2- and y2-axes, whilst the lower would draw gridlines from both the x- and the x2-axes.
If one of the specified axes does not exist, then no gridlines will be drawn in that direction. Gridlines can subsequently be removed selectively from some axes via:
set nogrid x2x3
The colors of gridlines can be controlled via the set gridmajcolor and set gridmincolor commands, which control the gridlines emanating from major and minor axis ticks respectively. The following example would set the minor grid lines on a graph to be drawn in blue:
set gridmajcolor gray70 set gridmincolor blue
Any of the color names listed in Section 19.4 can be used, as can any object of type color.