Learn R Programming

hierarchicalSets (version 1.0.4)

plot.HierarchicalSet: Visualize hierarchical sets

Description

This is the main visualization interface to HierarchicalSet object. By changing the type argument you control which types of plots are produced. See datails for a walkthrough of the different plot types. All plots are based on ggplot2 but heavily modified using gtable. Because of this the return value is always a gtable object, so it is not possible to add additional geoms, or change scales etc. on the result of plot().

Usage

# S3 method for HierarchicalSet
plot(
  x,
  label = TRUE,
  type = "dendrogram",
  transform = NULL,
  style = theme_bw(),
  quantiles = 0,
  upperBound = 1,
  tension = 0.8,
  alpha = 1,
  circular = TRUE,
  showHierarchy = !circular,
  evenHierarchy = circular,
  outliers = NULL,
  ratio = NULL,
  n = 50,
  ...
)

Value

A gtable object invisibly. This function is mainly called for the side effect of creating a plot.

Arguments

x

A HierarchicalSet object to plot.

label

logical. Should sets be labeled.

type

The type of plot to produce. See detail. The name of the type may be abbreviated.

transform

A string giving the scale transformation or a scales::trans() object.

style

A ggplot2 theme to use as basis for the plot. Defaults to theme_bw().

quantiles

The quantiles to split outlying elements up in for outlying_elements plot. If length is above one a facetted plot will be produced.

upperBound

The upper quantile threshold to include. Defaults to 1 (i.e. everything is included)

tension

The tension used for the hierarchical edge bundles in outlying_elements plot. Defaults to 0.8

alpha

The alpha level for the edge bundles. Defaults to 1

circular

Logical. Should the hierarchical edge bundles be laid out in a circular layout.

showHierarchy

Logical. For intersectionStack plots, should a dendrogram mapping union sizes be drawn above the icicle plot. For outlying_elements plots should a dendrogram be plotted below (for circular) or to the left (for linear) of the edge bundles.

evenHierarchy

Logical. Should the heights of the dendrogram used for constructing the edge bundles be evened out.

outliers

A precomputed data.frame with outlier information, as returned by outlying_elements().

ratio

Should outliers be plotted as a ratio instead of the raw number. If NULL the raw number is used, If "min" the raw number is divided by the number of elements in the smallest set of the pair, if "max" the largest set, and if "mean" the mean pair size.

n

The number of coordinates to calculate for each edge in the outlyingElements plot.

...

Currently ignored

Details

Currently 4 different plottypes are available:

dendrogram

Plots a horizontal dendrogram with the x-value mapped to the intersection size divided by the union size. This plot very clearly shows the rise in heterogenity as more and more sets are joined, and clearly shows clusters of very similar sets.

intersectStack

Plots a bottom-up icicleplot with height showing the size of the intersection. In essence this plot communicates the same type of information as a Venn-diagram, but in a scalable way and only showing the intersections along the hierarchy. Box color maps to the degree (number of sets) of the intersection making high-degree high-intersection as well as low-degree low-intersection boxes stand out.

heatmap

Plots a traditional heatmap showing all 2-degree intersections. The sets are organized according to the hierarchy so the result should show a number of squares along the diagonal. If two very similar sets have been forced apart by the clustering, this will show up nicely as high value squares away from the diagonal.

composite

Combines dendrogram, intersectStack and heatmap into a composite plot.

outlyingElements

Plots intersects between two sets that are missing from the intersect of their shared top node as hierarchical edge bundles. It helps detect deviations from the global structure as defined by the hierarchcial clustering.