% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/primitive-ticks.R
\name{primitive_ticks}
\alias{primitive_ticks}
\title{Guide primitive: line}
\usage{
primitive_ticks(key = NULL, bidi = FALSE, theme = NULL, position = waiver())
}
\arguments{
\item{key}{A \link[=key_standard]{standard key} specification. See more information
in the linked topic.}

\item{bidi}{A \verb{<logical[1]>}: whether ticks should be drawn bidirectionally
(\code{TRUE}) or in a single direction (\code{FALSE}, default).}

\item{theme}{A \code{\link[ggplot2:theme]{<theme>}} object to style the guide individually or
differently from the plot's theme settings. The \code{theme} argument in the
guide overrides and is combined with the plot's theme.}

\item{position}{A \verb{<character[1]>} giving the location of the guide. Can be one of \code{"top"},
\code{"bottom"}, \code{"left"} or \code{"right"}.}
}
\value{
A \code{PrimitiveTicks} primitive guide that can be used inside other
guides.
}
\description{
This function constructs a ticks \link[=guide-primitives]{guide primitive}.
}
\details{
\subsection{Styling options}{

Below are the \link[ggplot2:theme]{theme} options that determine the styling of
this guide, which may differ depending on whether the guide is used in
an axis or in a legend context.

The ticks can come in three variants: major, minor and minimal.
Which variants are drawn depends on the keys: \code{\link[=key_minor]{key_minor()}} draws major
and minor ticks, whereas \code{\link[=key_log]{key_log()}} also has minimal ticks.
Each variant has a corresponding length setting.

The possible \code{{position}} suffixes mentioned below are \code{x}, \code{x.top},
\code{x.bottom}, \code{y}, \code{y.left}, \code{y.right}. The \code{theta} and \code{r} position suffixes
in \pkg{ggplot2} are \emph{not} obeyed in \pkg{legendry}.\tabular{llll}{
   \strong{Theme setting} \tab \strong{Context} \tab \strong{Type} \tab \strong{Description} \cr
   \verb{axis.ticks.\{position\}} \tab Axis \tab \code{\link[ggplot2:element_line]{element_line()}} \tab Major tick lines \cr
   \verb{axis.ticks.length.\{position\}} \tab Axis \tab \code{\link[=unit]{unit()}} \tab Major tick length \cr
   \verb{axis.minor.ticks.\{position\}} \tab Axis \tab \code{\link[ggplot2:element_line]{element_line()}} \tab Minor tick lines \cr
   \verb{axis.minor.ticks.length.\{position\}} \tab Axis \tab \code{\link[=unit]{unit()}} \tab Minor tick length \cr
   \code{legendry.axis.mini.ticks} \tab Axis \tab \code{\link[ggplot2:element_line]{element_line()}} \tab Minimal tick lines \cr
   \code{legendry.axis.mini.ticks.length} \tab Axis \tab \code{\link[=unit]{unit()}} \tab Minimal tick length \cr
   \code{legend.ticks} \tab Legend \tab \code{\link[ggplot2:element_line]{element_line()}} \tab Major tick lines \cr
   \code{legend.ticks.length} \tab Legend \tab \code{\link[=unit]{unit()}} \tab Major ticks length \cr
   \code{legendry.legend.minor.ticks} \tab Legend \tab \code{\link[ggplot2:element_line]{element_line()}} \tab Minor tick lines \cr
   \code{legendry.legend.minor.ticks.length} \tab Legend \tab \code{\link[=unit]{unit()}} \tab Minor ticks length \cr
   \code{legendry.legend.mini.ticks} \tab Legend \tab \code{\link[ggplot2:element_line]{element_line()}} \tab Minimal tick lines \cr
   \code{legendry.legend.mini.ticks.length} \tab Legend \tab \code{\link[=unit]{unit()}} \tab Minimal tick length \cr
}


Styling options \emph{per break} can be set in the \link[=key_standard]{key}.
The \code{line} and prefixed properties are prioritised for the tick lines.
These override theme settings.

The context-agnostic alternative to using \code{theme()} is to use
\code{\link[=theme_guide]{theme_guide()}}:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{primitive_ticks(theme = theme_guide(
  ticks = element_line(),
  ticks.length = unit(5, "mm"),
  minor.ticks = element_line(),
  minor.ticks.length = unit(4, "mm"),
  mini.ticks = element_line(),
  mini.ticks.length = unit(3, "mm")
))
}\if{html}{\out{</div>}}
}
}
\examples{
# A standard plot
p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point()

# Adding as secondary guides
p + guides(x.sec = primitive_ticks(), y.sec = primitive_ticks())
}
\seealso{
Other primitives:
\code{\link[=primitive_box]{primitive_box()}},
\code{\link[=primitive_bracket]{primitive_bracket()}},
\code{\link[=primitive_fence]{primitive_fence()}},
\code{\link[=primitive_labels]{primitive_labels()}},
\code{\link[=primitive_line]{primitive_line()}},
\code{\link[=primitive_segments]{primitive_segments()}},
\code{\link[=primitive_spacer]{primitive_spacer()}},
\code{\link[=primitive_title]{primitive_title()}}
}
\concept{primitives}
