The plot for changepoints detected by the changepoint package is a line plot for the raw data and the vertical lines representing each changepoint. The x-axis is the row number of the raw data in the original data vector. The plot inherits ggplot2, meaning users can add ggplot2 functions on top the changepoint plot for customization.
Usage
ggcptplot(
data,
change_in = "mean_var",
cp_method = "PELT",
...,
cptline_alpha = 1,
cptline_color = "blue",
cptline_type = "solid",
cptline_size = 0.5
)
Arguments
- data
A vector.
- change_in
Choice of
mean_var
,mean
,var
, andcpt_np
. Each choice corresponds tocpt.meanvar()
,cpt.mean()
,cpt.var()
andcpt.np()
respectively. The default ismean_var
.- cp_method
A wide range of choices (i.e.,
AMOC
,PELT
,SegNeigh
orBinSeg
). Please note whenchange_in
iscpt_np
,PELT
is the only option.- ...
Extra arguments for each
cpt
function mentioned in thechange_in
section.- cptline_alpha
The value of alpha for the vertical changepoint line(s), default is 1, meaning no transparency.
- cptline_color
The color for the vertical changepoint line(s), default is
blue
.- cptline_type
The linetype for the vertical changepoint line(s), default is
solid
.- cptline_size
The size for the vertical changepoint line(s), default is
0.5
.