% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom-ridgeline-3d.R
\name{geom_ridgeline_3d}
\alias{geom_ridgeline_3d}
\title{3D ridgeline plot from point grid}
\usage{
geom_ridgeline_3d(
  mapping = NULL,
  data = NULL,
  stat = "identity_3d",
  position = "identity",
  ...,
  direction = "x",
  base = NULL,
  cull_backfaces = FALSE,
  sort_method = "pairwise",
  scale_depth = TRUE,
  force_convex = FALSE,
  light = NULL,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}}.}

\item{data}{Point grid data with x, y, z coordinates.}

\item{stat}{Statistical transformation. Defaults to "identity".}

\item{position}{Position adjustment, defaults to "identity".}

\item{...}{Other arguments passed to the layer.}

\item{direction}{Direction of ridges:
\describe{
\item{"x"}{One ridge per unique x value; ridge varies in y (default)}
\item{"y"}{One ridge per unique y value; ridge varies in x}
}}

\item{base}{Z-value for ridge polygon bottoms. If NULL, uses min(z).}

\item{cull_backfaces}{Logical indicating whether to remove back-facing polygons
from rendering. This is primarily for performance optimization but may be useful
for aesthetic reasons in some situations. Backfaces are determined using
screen-space winding order after 3D transformation. Defaults vary by geometry
type: FALSE for open surface-type geometries, TRUE for solid objects (hulls,
voxels, etc. where backfaces are generally hidden unless frontfaces are transparent
or explicitly disabled).}

\item{sort_method}{Depth sorting algorithm. See \link{sorting_methods} for details.}

\item{scale_depth}{Logical indicating whether polygon linewidths should be scaled to make closer lines
wider and farther lines narrower. Default is TRUE. Scaling is based on the mean depth of a polygon.}

\item{force_convex}{Logical indicating whether to remove polygon vertices that are not part of the
convex hull. Default value varies by geom. Specifying TRUE can help reduce artifacts in surfaces
that have polygon tiles that wrap over a visible horizon. For prism-type geoms like columns and
voxels, FALSE is safe because polygons fill always be convex.}

\item{light}{A lighting specification object created by \code{\link[=light]{light()}},\code{"none"} to disable
lighting, or \code{NULL} to inherit plot-level lighting specs from the coord. Specify
plot-level lighting in \code{coord_3d()} and layer-specific lighting in \verb{geom_*3d()}
functions.}

\item{na.rm}{If \code{FALSE}, missing values are removed.}

\item{show.legend}{Logical indicating whether this layer should be included in legends.}

\item{inherit.aes}{If \code{FALSE}, overrides the default aesthetics.}
}
\value{
A \code{Layer} object that can be added to a ggplot.
}
\description{
Renders a point grid as ridgeline polygons (Joy Division style). Each slice
along one axis becomes a filled polygon, creating a cross-sectional view
of the surface.
}
\section{Aesthetics}{

\describe{
\item{x, y, z}{Point coordinates (required)}
\item{fill}{Polygon fill color (default: "grey70")}
\item{colour}{Polygon border color (default: "black")}
\item{alpha}{Transparency}
\item{linewidth}{Border width}
\item{linetype}{Border type}
}
}

\examples{
# From point grid
grid_data <- expand.grid(x = seq(-3, 3, 0.5), y = seq(-3, 3, 0.1))
grid_data$z <- with(grid_data, dnorm(y) * dnorm(x) * 10)

ggplot(grid_data, aes(x, y, z = z)) +
  geom_ridgeline_3d() +
  coord_3d()

# With fill
ggplot(grid_data, aes(x, y, z = z, fill = x)) +
  geom_ridgeline_3d(colour = "white", linewidth = 0.3) +
  scale_fill_viridis_c() +
  coord_3d()

# Ridges in y direction
ggplot(grid_data, aes(x, y, z = z)) +
  geom_ridgeline_3d(direction = "y", fill = "steelblue") +
  coord_3d()

# With stat_function_3d
ggplot() +
  stat_function_3d(fun = function(x, y) sin(x) * cos(y),
                   xlim = c(-pi, pi), ylim = c(-pi, pi),
                   n = 30,
                   geom = "ridgeline_3d") +
  coord_3d()

}
\seealso{
\code{\link[=geom_surface_3d]{geom_surface_3d()}}, \code{\link[=stat_function_3d]{stat_function_3d()}}, \code{\link[=coord_3d]{coord_3d()}}
}
