The Mercator Distance Visualization Object
The Mercator object represents a distance matrix together with
clustering assignments and a set of visualizations. It implements four
visualizations for clusters of large-scale, multi-dimensional data:
hierarchical clustering, multi-dimensional scaling, t-Stochastic
Neighbor Embedding (t-SNE), and iGraph. The default
Mercator constructor applies one of ten metrics of
binaryDistance to an object of the
BinaryMatrix class.
Mercator(X, metric, method, K, ...) addVisualization(DV, method, ...) getClusters(DV)
X |
Either a |
metric |
A |
method |
A visualization method, currently limited to
|
K |
An |
DV |
A distance visualization produced as the output of the
|
... |
Additional arguments passed on to the functions that
implement different methods for
|
The Mercator function constructs and returns a distance
visualization object of the
Mercator class, including a distance matrix calculated on a
given metric and given visualizations. It is also possible (though not
advisable) to construct a Mercator obecject directly using the
new function.
The addVisualizations function can be used to add additional
visualizations to an existing Mercator object.
The getClusters function returns a vector of cluster assignments.
metric:Object of class "character"; the name
of the binaryDistance applied to create this object.
distance:Object of class "dist"; the distance
matrix used and represented by this object.
view:Object of class "list"; contains the
results of calculations to generate each visualize the object.
clusters:A numeric vector of cluster assignments.
symbols:A numeric vector of valid plotting
characters, as used by par(pch).
palette:A character vector of color names.
Produce a plot of one or more visualizations within a
Mercator object. The default view, when omitted, is the
first one contained in the object. You can request multiple views
at once; if the current plot layout doesn't have enough space in
an interactive session, the ask parameters detemines whether
the system will ask you before advancing to the next plot. When
plotting a graph view, you can use an optional layout
parameter to select a specific layout by name.
Produce a (colored) barplot of the silhouette widths for elements
clustered in this class. Arguments are as described in te base
function barplot.
Produce a smooth scatter plot of one or more visualizations within a
Mercator object. The default view, when omitted, is the
first one contained in the object. You can request multiple views
at once; if the current plot layout doesn't have enough space in
an interactive session, the ask parameters detemines whether
the system will ask you before advancing to the next plot. When
plotting a graph view, you can use an optional layout
parameter to select a specific layout by name. Arguments are
otherwise the same as the smoothScatter function,
execpt that the default color ramp is topo.colors.
signature(object = "Mercator")
Produce a histogram of distances calculated in the dissimilarity
matrix generated in the Mercator object.
signature(object = "Mercator")
Returns the chosen distance metric, dimensions of the distance matrix, and available, calculated visualizations in this object.
signature(object = "Mercator")
Returns the dimensions of the distance matrix of this object.
signature(object = "Mercator")
Subsets the distance matrix of this object.
Kevin R. Coombes <krc@silicovore.com>, Caitlin E. Coombes
#Form a BinaryMatrix
data("iris")
my.data <- as.matrix(iris[,c(1:4)])
my.rows <- as.data.frame(c(1:length(my.data[,1])))
my.binmat <- BinaryMatrix(my.data, , my.rows)
my.binmat <- t(my.binmat)
summary(my.binmat)
# Form a Mercator object
# Set K to the known number of species in the dataset
my.vis <- Mercator(my.binmat, "euclid", "hclust", K=3)
summary(my.vis)
hist(my.vis)
barplot(my.vis)
my.vis <- addVisualization(my.vis, "mds")
plot(my.vis, view = "hclust")
plot(my.vis, view = "mds")
scatter(my.vis, view ="mds")
# change the color palette
slot(my.vis, "palette") <- c("purple", "red", "orange", "green")
scatter(my.vis, view ="mds")
#Recover cluster identities
#What species comprise cluster 1?
my.clust <- getClusters(my.vis)
my.species <- iris$Species[my.clust == 1]
my.speciesPlease choose more modern alternatives, such as Google Chrome or Mozilla Firefox.