emstreeR (version 3.1.2)

plotMST3D: 3D Minimum Spanning Tree Plot

Description

Plots a 3D MST by producing a point cloud with segments as a 'scatterplot3d' graphic.

Usage

plotMST3D(
  tree,
  x = 1,
  y = 2,
  z = 3,
  col.pts = "black",
  col.segts = "black",
  angle = 40,
  ...
)

Arguments

tree

a MST class object returned by the ComputeMST() function.

x

the numeric position or the name of the column to be used as the x coordinates of points in the plot.

y

the numeric position or the name of the column to be used as the y coordinates of points in the plot.

z

the numeric position or the name of the column to be used as the z coordinates of points in the plot.

col.pts

color of points (vertices/nodes) in the plot.

col.segts

color of segments (edges) in the plot.

angle

angle between x and y axis (Attention: result depends on scaling).

...

further graphical parameters.

Examples

Run this code

## 3D artificial data:
n1 = 12
n2 = 22
n3 = 7
n = n1 + n2 + n3
set.seed(1984)

mean_vector <- sample(seq(1, 10, by = 2), 3)
sd_vector <- sample(seq(0.01, 0.8, by = 0.01), 3)
c1 <- matrix(rnorm(n1*3, mean = mean_vector[1], sd = .3), n1, 3)
c2 <- matrix(rnorm(n2*3, mean = mean_vector[2], sd = .5), n2, 3)
c3 <- matrix(rnorm(n3*3, mean = mean_vector[3], sd = 1), n3, 3)
d<-rbind(c1, c2, c3)

## MST:
out <- ComputeMST(d)

## 3D PLOT:
plotMST3D(out)

Run the code above in your browser using DataLab