Draws gridlines at specified positions, with style defaults taken from the
panel.grid.major element of the set theme. Crop bounds (xmin, xmax,
ymin, ymax) both filter which lines are drawn and control how far they
run across the panel.
Usage
panel_grid(
xintercept = NULL,
yintercept = NULL,
xmin = -Inf,
xmax = Inf,
ymin = -Inf,
ymax = Inf,
colour = NULL,
linewidth = NULL,
linetype = NULL,
layout = NULL
)Arguments
- xintercept
One or more x positions for vertical gridlines, in data coordinates or wrapped in
I()for normalised panel coordinates (npc). May be a vector.- yintercept
One or more y positions for horizontal gridlines, in data coordinates or wrapped in
I()for normalised panel coordinates (npc). May be a vector.- xmin, xmax
Left and right crop bounds. Vertical gridlines outside
[xmin, xmax]are not drawn; horizontal gridlines run only fromxmintoxmax. Defaults to-InfandInf(full panel). UseI()for normalised coordinates (npc). Note: filtering (removing lines outside the range) only works when both the crop bound and the intercept are in data coordinates. npc bounds affect extent only.- ymin, ymax
Bottom and top crop bounds. Horizontal gridlines outside
[ymin, ymax]are not drawn; vertical gridlines run only fromymintoymax. Defaults to-InfandInf(full panel). UseI()for normalised coordinates (npc). Note: filtering only works when both the crop bound and the intercept are in data coordinates. npc bounds affect extent only.- colour
Inherits from
panel.grid.majorin the set theme. May be a vector the same length as the total number of lines.- linewidth
Inherits from
panel.grid.majorin the set theme. Supportsrel(). May be a vector the same length as the total number of lines.- linetype
Inherits from
panel.grid.majorin the set theme. May be a vector the same length as the total number of lines.- layout
Controls which panels the annotation appears in.
NULL(default) repeats in all panels. An integer targets a specific panel."fixed"repeats in all panels ignoring faceting variables. Seeggplot2::layer()for full details.