plot-BinSeg-method: Plot the data with segments

Description Usage Arguments Value Details See Also

Description

This method provides a convenient way to visualize changepoint models. The changepoints are drawn as vertical line on top of the input data. Furthermore, several models (different number of changepoints) can be plotted at once.

Usage

1
2
3
4
5
6
7
## S4 method for signature 'BinSeg'
plot(
  object,
  ncpts = seq_len(nrow(object@models_summary)),
  y_axis = seq_along(object@data),
  title = paste("BinSeg changepoint analysis")
)

Arguments

object

A valid BinSeg object

ncpts

Numeric vector (might be atomic) specifying the different models to be plotted as the number of changepoints.

y_axis

A numeric vector to be used for the y axis of the graph.

title

The title of the graph

Value

A ggplot graph with the plot of the specified segmentation models

Details

This method allows to visualize several changepoint models at the same time. Each one of them is separated by using a face grid. If you input only one number in ncpts (e.g. 5L), then only that segment will be graphed without facet grid. When you pass a vector with several values (e.g. 1:3), then the models with those number of changepoints will be graphed. Each of them will be graphed on a separate grid space. Rearding the y axis, the default setting is to use the indexes of the input data vector (starting from 1 up to the length of the vector). However, if you have a y axis you can provide it on the y_axis parameter. Beware that it must be of the same length as the input data vector.

See Also

plotDiagnostic for a diagnostic plot that graphs the costs.


diego-urgell/BinSeg documentation built on Dec. 19, 2021, 11:11 p.m.