% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotly_Utils.R
\name{add_shapes}
\alias{add_shapes}
\title{Add shapes to plotly plot}
\usage{
add_shapes(p = plotly::last_plot(), shapes)
}
\arguments{
\item{p}{The plot to which the shape should be added. Default is the
\code{last_plot()}.}

\item{shapes}{A list of attributes that specify a shape. Note that only one
shape can be added for each call, but to be consistent with the \code{shapes} argument
to \code{\link[plotly:layout]{plotly::layout()}}, we use the same plural.}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}

Modifies the layout object of an existing plot to include a new shape.
}
\details{
This function adds a shape to the layout element of a plotly plot.
Type \code{schema()} in the console and expand the list for
layout > layoutAttributes > shapes for details on how
to specify a shape. A convenient Pmetrics helper function to add line shapes
is \link{ab_line}. Other shapes such as circles, rectangles and paths can be added,
but must be done manually as outlined in the plotly schema documentation.
An example of a circle shape is below in examples.
}
\examples{
#'
\dontrun{
NPex$op$plot() |>
  add_shapes(shapes = ab_line(v = 12))

NPex$data$plot() |>
  add_shapes(shapes = list(type = "circle", x0 = 125, y0 = 10, x1 = 135, y1 = 15))
}
}
\seealso{
\link{ab_line}
}
