plot.CirClust: Plot Method for Circular Data Clustering

Description Usage Arguments Value Examples

View source: R/plot-CirClust.R

Description

The plot method for circular data clustering result object of class CirClust. It visualizes circular clusters on the input data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## S3 method for class 'CirClust'
plot(
  x,
  xlab = "",
  ylab = "",
  main = NULL,
  sub = "",
  col.clusters = c("blue", "red3", "green3", "orange", "purple", "brown"),
  axes = FALSE,
  xlim = c(-1.75, 1.75),
  ylim = c(-1.75, 1.75),
  fill = "floralwhite",
  border = "gray36",
  border.lty = "dotted",
  ...
)

Arguments

x

an object of class as returned by CirClust

xlab

a character string. The x-axis label for the plot. Default is no string.

ylab

a character string. The y-axis label for the plot. Default is no string.

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. By default the blue, red3, green3, orange, purple, brown colors are used in the plot.

axes

the axis will be ploted if set TRUE. Default is FALSE.

xlim

range of the x axis in the plot. Default is from -1.75 to 1.75.

ylim

range of the y axis in the plot. Default is from -1.75 to 1.75.

fill

the color to fill inside the ring as the background of data points.

border

the color to draw cluster borders.

border.lty

the line type to draw cluster borders.

...

other arguments associated with the plot function

Value

A copy of the input object of class CirClust.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
opar <- par(mar=c(1,1,2,1))
# Example 1. Circular data clustering
n <- 100
Circumference <- 7
O <- runif(n, 0, Circumference)
result <- CirClust(O, K=3, Circumference=Circumference)
plot(result, fill="mintcream", main="Example 1. Circular clustering")


# Example 2. Circular data clustering
n <- 40
m <- 5
O <- c(rnorm(n,mean=5,sd=m), rnorm(n,mean=15,sd=m), rnorm(n,mean=26,sd=m))
K <- 3
Circumference <- 28

result <- CirClust(O, K, Circumference, method = "FOCC")

color <- c("royalblue", "green3", "firebrick") # c("#0000CD","#808080", "#DC143C")

par(mar=c(1,1,2,1))

plot(result, col.clusters = color, fill="floralwhite",
     main="Example 2. Circular clustering")


# Example 3. Periodic data clustering
n <- 100
period <- 5.2
O <- rnorm(n)
result <- CirClust(O, K=5, Circumference=period)
plot(result, fill="navy", border="gray", border.lty="dotted",
     main="Example 3. Periodic clustering")

par(opar)

OptCirClust documentation built on July 28, 2021, 9:06 a.m.