plot.Cksegs.1d.dp {Ckmeans.1d.dp} R Documentation

## Plot Optimal Univariate Segmentation Results

### Description

Plot optimal univariate segmentation results returned from `Cksegs.1d.dp`.

### Usage

```## S3 method for class 'Cksegs.1d.dp'
plot(x, xlab=NULL, ylab=NULL, main=NULL,
sub=NULL, col.clusters=NULL, ...)
```

### Arguments

 `x` an object of class as returned by `Cksegs.1d.dp`. `xlab` a character string. The x-axis label for the plot. `ylab` a character string. The x-axis label for the plot. `main` a character string. The title for the plot. `sub` a character string. The subtitle for the plot. `col.clusters` a vector of colors, defined either by integers or by color names. If the length is shorter than the number of clusters, the colors will be reused. `...` arguments passed to `plot` function in package graphics.

### Details

The function `plot.Cksegs.1d.dp` shows segments as horizontal lines from the univariate segmentation results obtained from function `Cksegs.1d.dp`. It uses different colors to indicate segments.

### Value

An object of class "`Cksegs.1d.dp`" defined in `Cksegs.1d.dp`.

Joe Song

### References

Wang, H. and Song, M. (2011) Ckmeans.1d.dp: optimal k-means clustering in one dimension by dynamic programming. The R Journal 3(2), 29–33. Retrieved from https://journal.r-project.org/archive/2011-2/RJournal_2011-2_Wang+Song.pdf

### Examples

```# Example: clustering data generated from a Gaussian
#          mixture model of three components
x <- c(rnorm(50, mean=-1, sd=0.3),
rnorm(50, mean=1, sd=0.3),
rnorm(50, mean=3, sd=0.3))

y <- x^3
res <- Cksegs.1d.dp(y, x=x)
plot(res, lwd=2)

```

[Package Ckmeans.1d.dp version 4.3.3 Index]