Arguments
- p
The plot to which the shape should be added. Default is the
last_plot()
.- 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
shapes
argument toplotly::layout()
, we use the same plural.
Details
This function adds a shape to the layout element of a plotly plot.
Type 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 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.