Learn R Programming

hydra (version 0.1.0)

plot.hydra: Plot a hyperbolic embedding

Description

Plot a two-dimensional hyperbolic embedding as returned by hydra in the Poincare disc

Usage

# S3 method for hydra
plot(x, labels = NULL, node.col = 1, pch = NULL,
  graph.adj = NULL, crop.disc = TRUE, shrink.disc = FALSE,
  disc.col = "grey90", rotation = 0, mark.center = 0,
  mark.angles = 0, mildify = 3, cex = 1, ...)

Arguments

x

a hydra object as returned by hydra with dimension dim equal 2

labels

character labels for the embedded points, supplied as a vector. NULL triggers default values

node.col

colors for the labels and/or points, supplied as a vector. NULL triggers default values. See `Color Specification' in par for details

pch

plotting 'characters' for the embedded points. supplied as a vector. NULL triggers default values. See points for details

graph.adj

a graph adjacency matrix that is used to plot links between the embedded points (links are drawn for all non-zero elements of graph.adj)

crop.disc

should the Poincare disc be cropped or fully shown? Defaults to TRUE

shrink.disc

if true, the Poincare disc is shrunk to tightly fit all plotted points. Defaults to FALSE

disc.col

color of the Poincare disc. Set to "white" to hide disc

rotation

rotate points by this angle (specified in degrees) around the center of the Poincare disc

mark.center

Should a cross be placed at the center of the disc? If 0, nothing is drawn. Other values specify the relative size of the cross mark.

mark.angles

Should the angular coordinates of points be marked at the boundary of the disc? If 0, nothing is drawn. Other values specify the relative size of the angle marks.

mildify

large values reduce the curvature of links. Values around 3 are visually most appealing. Setting mildify to 1 shows the true hyperbolic curvature

cex

character expansion for labels and points, supplied as a numerical vector. See also points

...

all other parameters are passed on as additional graphical parameters (see par)

Examples

Run this code
# NOT RUN {
data(karate)
embedding <- hydra(karate$distance)
plot(embedding,labels=karate$label,node.col=karate$group,graph.adj=karate$adjacency)

# plot points instead of labels, hide Poincare disc and rotate by 90 degrees:
plot(embedding,pch=karate$group, node.col=karate$group,graph.adj=karate$adjacency, disc.col="white",
     rotation=90)

# do not crop the Poincare disc, mark the center and mark angles:
plot(embedding,labels=karate$label, node.col=karate$group,graph.adj=karate$adjacency,
     crop.disc=FALSE, mark.center=0.05, mark.angles=0.025)

# }

Run the code above in your browser using DataLab