% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scale-z.R
\name{scale_z_discrete}
\alias{scale_z_discrete}
\title{Discrete z-axis scale for 3D plots}
\usage{
scale_z_discrete(
  name = waiver(),
  breaks = waiver(),
  labels = waiver(),
  limits = NULL,
  expand = waiver(),
  guide = "none",
  na.translate = TRUE,
  na.value = NA_real_,
  drop = TRUE,
  ...
)
}
\arguments{
\item{name}{The name of the scale, used as the axis title. Use \code{waiver()} for
the default, or \code{NULL} to omit the title.}

\item{breaks}{One of:
\itemize{
\item \code{NULL} for no breaks
\item \code{waiver()} for all breaks
\item A character vector of breaks
\item A function that takes the limits as input and returns breaks as output
}}

\item{labels}{One of:
\itemize{
\item \code{NULL} for no labels
\item \code{waiver()} for the default labels
\item A character vector giving labels (must be same length as breaks)
\item A function that takes the breaks as input and returns labels as output
}}

\item{limits}{A character vector that defines possible values of the scale and their order.}

\item{expand}{A numeric vector of length two giving multiplicative and additive expansion constants.
These constants ensure that data is placed some distance away from the axes. The defaults are
to expand by 0.6 units on each side for discrete scales.}

\item{guide}{A function used to create a guide or its name. Since z-axis guides are not
yet supported, this defaults to \code{"none"}.}

\item{na.translate}{Unlike continuous scales, discrete scales can easily show missing values,
and do so by default. If you want to remove missing values from a discrete scale, specify
\code{na.translate = FALSE}.}

\item{na.value}{If \code{na.translate = TRUE}, what aesthetic value should the missing values be
displayed as? Does not apply to position scales where \code{NA} is always placed at the far right.}

\item{drop}{Should unused factor levels be omitted from the scale? The default, \code{TRUE}, uses
the levels that appear in the data; \code{FALSE} uses all the levels in the factor.}

\item{...}{Other arguments passed on to \code{discrete_scale()}.}
}
\value{
A ggplot2 scale object for the z aesthetic.
}
\description{
\code{scale_z_discrete} creates a discrete scale for the z aesthetic in 3D plots.
It works with categorical/factor data, positioning each level at integer coordinates
(1, 2, 3, ...) in 3D space.
}
\examples{
library(ggplot2)

# Basic usage to control order, breaks, labels, expansion, etc.
ggplot(mpg, aes(displ, cty, drv, color = drv)) +
      geom_point() +
      scale_z_discrete(limits = c("f", "r", "4"), # change default order
                       breaks = c("f", "r", "4"),
                       labels = c("front", "rear", "4-wheel"),
                       expand = expansion(.5)) +
      coord_3d()

}
\seealso{
\code{\link{scale_z_continuous}} for continuous z-axis scaling,
\code{\link{coord_3d}} for the 3D coordinate system

Other 3D scale functions: 
\code{\link{scale_z_continuous}()},
\code{\link{zlim}()}
}
\concept{3D scale functions}
