Title: | Focused, Interactive Multidimensional Scaling |
---|---|
Description: | Takes a distance matrix and plots it as an interactive graph. One point is focused at the center of the graph, around which all other points are plotted in their exact distances as given in the distance matrix. All other non-focus points are plotted as best as possible in relation to one another. Double click on any point to choose a new focus point, and hover over points to see their ID labels. If color label categories are given, hover over colors in the legend to highlight only those points and click on colors to highlight multiple groups. For more information on the rationale and mathematical background, as well as an interactive introduction, see <https://lea-urpa.github.io/focusedMDS.html>. |
Authors: | Lea Urpa [cre], Simon Anders [aut] |
Maintainer: | Lea Urpa <[email protected]> |
License: | GNU General Public License |
Version: | 1.3.3 |
Built: | 2025-02-13 04:42:32 UTC |
Source: | https://github.com/cran/focusedMDS |
focusedMDS
takes a distance matrix and plots
it as an interactive graph. Double click on
any point to choose a new focus point, and hover over
points to see their ID labels. In this graph, one point
is focused on at the center of the graph. All other points
are plotted around this central point at their exact
distances to the point, as given in the distance matrix.
In other words, the distance between each point and the
focus point are the true distances given in the distance
matrix. The non focus points are plotted with respect to
each other as exactly as possible. For more details, see
https://lea-urpa.github.io/focusedMDS.html.
focusedMDS(distances, ids = NULL, color_cat = NULL, focus_point = ids[1], size = NULL, circles = 7, tol = 0.001, check_matrix = FALSE, subsampling = FALSE, color_palette = NULL, title = NULL)
focusedMDS(distances, ids = NULL, color_cat = NULL, focus_point = ids[1], size = NULL, circles = 7, tol = 0.001, check_matrix = FALSE, subsampling = FALSE, color_palette = NULL, title = NULL)
distances |
A square, symmetric distance matrix or
|
ids |
A vector with length equal to the
number of rows of the matrix given in |
color_cat |
A vector with length equal to the
number of rows of the matrix given in |
focus_point |
The initial ID to be plotted at the
center of the focusedMDS graph (default is the first
element in the |
size |
The fixed size of the focusedMDS graph, in pixels. Disables dynamic sizing. |
circles |
The number of background polar gridlines. |
tol |
The tolerance for the optimization method choosing the location of the non-focus points. Default 0.001. |
check_matrix |
Logical value permitting additional checks of the matrix, ensuring that the given matrix fulfills the triangle inequality. Slows down the initial graph plotting, but useful if you are not sure if your matrix is a distance matrix or has been calculated correctly. |
subsampling |
Logical value stating that for samples of over 100 points, each point iteratively plotted after the 100th point will be optimized to a subsample of the previously plotted data points. Recommended for plotting data sets with more than 300 points. |
color_palette |
Optional specification of a color palette to use
when |
title |
Optional title for plot, must be a single character string. |
# See http://lea-urpa.github.io/focusedMDS.html for # an illustrated version of this example. library(datasets) library(focusedMDS) # Load Edgar Anderson's Iris Data data("iris") # Create table of measures to compare individuals on table <- iris[ , c("Petal.Length", "Petal.Width", "Sepal.Length", "Sepal.Width")] # Find euclidean distances based on these measures dists <- dist(table) # Simplest usage: only with dataset focusedMDS(dists) # Create labels based on flower species colorvector <- as.vector(iris$Species) colors <- c("firebrick", "cornflowerblue", "gold") # Visualization with color labels focusedMDS(dists, color_cat = colorvector, color_palette = colors ) # Create text labels table(iris$Species) names <- c(paste(rep("setosa", 50), 1:50, sep=""), paste(rep("versicolor", 50), 1:50, sep=""), paste(rep("virginica", 50), 1:50, sep="")) focusedMDS(dists, ids = names, color_cat = colorvector, color_palette = colors)
# See http://lea-urpa.github.io/focusedMDS.html for # an illustrated version of this example. library(datasets) library(focusedMDS) # Load Edgar Anderson's Iris Data data("iris") # Create table of measures to compare individuals on table <- iris[ , c("Petal.Length", "Petal.Width", "Sepal.Length", "Sepal.Width")] # Find euclidean distances based on these measures dists <- dist(table) # Simplest usage: only with dataset focusedMDS(dists) # Create labels based on flower species colorvector <- as.vector(iris$Species) colors <- c("firebrick", "cornflowerblue", "gold") # Visualization with color labels focusedMDS(dists, color_cat = colorvector, color_palette = colors ) # Create text labels table(iris$Species) names <- c(paste(rep("setosa", 50), 1:50, sep=""), paste(rep("versicolor", 50), 1:50, sep=""), paste(rep("virginica", 50), 1:50, sep="")) focusedMDS(dists, ids = names, color_cat = colorvector, color_palette = colors)