Learn R Programming

colordistance (version 1.1.2)

plotClustersMulti: Plot several different cluster sets together

Description

Plots cluster sets from several different dataframes on a single plot for easy comparison.

Usage

plotClustersMulti(
  cluster.list,
  color.space = "rgb",
  p = "all",
  title = "",
  ref.white,
  to = "sRGB"
)

Arguments

cluster.list

A list of identically sized dataframes with 4 columns each as output by extractClusters, getLabHistList, or getHistList.

color.space

The color space ("rgb", "hsv", or "lab") in which to plot pixels.

p

Numeric vector of indices for which elements to plot; otherwise all of the cluster sets provided will be plotted together.

title

Optional title for the plot.

ref.white

The reference white passed to convertColorSpace; must be specified if using color.space = "lab".

to

Display color space of image if clustering in CIE Lab space, probably either "sRGB" or "Apple RGB", depending on your computer.

Value

A single plot_ly plot of every cluster in a list of cluster sets. Each cluster is colored by cluster color, proportional to cluster size, and labeled according to the image from which it originated.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# Takes >10 seconds
cluster.list <- colordistance::getHistList(dir(system.file("extdata",
"Heliconius/", package="colordistance"), full.names=TRUE), plotting=FALSE,
lower=rep(0.8, 3), upper=rep(1, 3))

colordistance::plotClustersMulti(cluster.list, p=c(1:4), title="Orange and
black Heliconius")

colordistance::plotClustersMulti(cluster.list, p=c(5:8), title="Black, yellow,
and red Heliconius")

clusterListHSV <- colordistance::getHistList(dir(system.file("extdata",
"Heliconius/", package="colordistance"), full.names=TRUE), hsv=TRUE,
plotting=FALSE, lower=rep(0.8, 3), upper=rep(1, 3))

colordistance::plotClustersMulti(clusterListHSV, p=c(1:3, 7:8), hsv=TRUE)
# }

Run the code above in your browser using DataLab