plot.Ckmeans.1d.dp: Plot Optimal Univariate Clustering Results

Description Usage Arguments Details Value Author(s) Examples

View source: R/visualize.R

Description

Plot optimal univariate clustering results returned from Ckmeans.1d.dp.

Usage

1
2
3
4
5
6
## S3 method for class 'Ckmeans.1d.dp'
plot(x, xlab=NULL, ylab=NULL, main=NULL,
      sub=NULL, col.clusters=NULL, ...)
## S3 method for class 'Ckmedian.1d.dp'
plot(x, xlab=NULL, ylab=NULL, main=NULL,
      sub=NULL, col.clusters=NULL, ...)

Arguments

x

an object of class as returned by Ckmeans.1d.dp or Ckmedian.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 functions plot.Ckmeans.1d.dp and plot.Ckmedian.1d.dp visualize the input data as sticks whose heights are the weights. They use different colors to indicate clusters.

Value

An object of class "Ckmeans.1d.dp" or "Ckmedian.1d.dp" defined in Ckmeans.1d.dp.

Author(s)

Joe Song

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 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))

res <- Ckmeans.1d.dp(x)
plot(res)

y <- (rnorm(length(x)))^2
res <- Ckmeans.1d.dp(x, y=y)
plot(res)

res <- Ckmedian.1d.dp(x)
plot(res)

Example output



Ckmeans.1d.dp documentation built on July 22, 2020, 5:09 p.m.