% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_modifier}
\alias{layout_modifier}
\title{Create a layout modifier}
\usage{
layout_modifier(...)
}
\arguments{
\item{...}{Named arguments that define the modifier. Must include:
\describe{
\item{id}{A unique identifier string for the modifier}
\item{type}{Either \code{"pre"} for pre-layout or \code{"post"} for post-layout}
\item{args}{A list of arguments to pass to the apply function}
\item{apply}{A function with signature
\verb{function(graph, layout, modifier_args)} that performs the modification}
}}
}
\value{
An object of class \code{igraph_layout_modifier}.
}
\description{
This is a constructor function for creating custom layout modifiers.
Layout modifiers can be used with \code{\link[=layout_]{layout_()}} to modify how layouts
are calculated or to transform the resulting coordinates.
}
\examples{
# Create a custom post-layout modifier that scales coordinates
scale_by <- function(factor) {
  layout_modifier(
    id = "scale_by",
    type = "post",
    args = list(factor = factor),
    apply = function(graph, layout, modifier_args) {
      layout * modifier_args$factor
    }
  )
}

# Use the custom modifier
g <- make_ring(10)
coords <- layout_(g, in_circle(), scale_by(2))
plot(g, layout = coords)
}
\seealso{
\code{\link[=layout_]{layout_()}} for using modifiers, \code{\link[=component_wise]{component_wise()}}, \code{\link[=normalize]{normalize()}}
for examples of built-in modifiers.

Other layout modifiers: 
\code{\link{component_wise}()},
\code{\link{normalize}()}
}
\concept{layout modifiers}
