Learn R Programming

DataVisualizations (version 1.3.3)

Sheparddiagram: Draws a Shepard Diagram

Description

This function plots a Shepard diagram which is a scatter plot of InputDist and OutputDist

Usage

Sheparddiagram(InputDists, OutputDists, xlab = "Input Distances",

ylab= "Output Distances", fancy = F,

main = "ProjectionMethod", gPlot = ggplot())

Value

ggplot2 object containing the plot.

Arguments

InputDists

[1:n,1:n] with n cases of data in d variables/features: Matrix containing the distances of the inputspace.

OutputDists

[1:n,1:n] with n cases of data in d dimensionalites of the projection method variables/features: Matrix containing the distances of the outputspace.

xlab

Label of the x axis in the resulting Plot.

ylab

Label of the y axis in the resulting Plot.

fancy

Set FALSE for PC and TRUE for publication

main

Title of the Shepard diagram

gPlot

ggplot2 object to plot upon.

Author

Michael Thrun

Examples

Run this code
data("Lsun3D")
Cls=Lsun3D$Cls
Data=Lsun3D$Data
InputDist=as.matrix(dist(Data))
res = stats::cmdscale(d = InputDist, k = 2, eig = TRUE, 
        add = FALSE, x.ret = FALSE)
ProjectedPoints = as.matrix(res$points)
# \donttest{

Sheparddiagram(InputDist,as.matrix(dist(ProjectedPoints)),main = 'MDS')
# }
# \dontshow{

Sheparddiagram(InputDist[1:100,1:100],as.matrix(dist(ProjectedPoints))[1:100,1:100],main = 'MDS')
# }

Run the code above in your browser using DataLab