plot.diagram: Plot the Persistence Diagram

View source: R/plot.diagram.R

plot.diagramR Documentation

Plot the Persistence Diagram

Description

The function plot.diagram plots the Persistence Diagram stored in an object of class diagram. Optionally, it can also represent the diagram as a persistence barcode.

Usage

## S3 method for class 'diagram'
plot(
    x, diagLim = NULL, dimension = NULL, col = NULL,
    rotated = FALSE, barcode = FALSE, band = NULL, lab.line = 2.2,
    colorBand = "pink", colorBorder = NA, add = FALSE, ...)

Arguments

x

an object of class diagram (as returned by the functions alphaComplexDiag, alphaComplexDiag, gridDiag, or ripsDiag) or an n by 3 matrix, where n is the number of features to be plotted.

diagLim

numeric vector of length 2, specifying the limits of the plot. If NULL then it is automatically computed using the lifetimes of the features.

dimension

number specifying the dimension of the features to be plotted. If NULL all the features are plotted.

col

an optional vector of length P that stores the colors of the topological features to be plotted, where P is the number of topological features stored in x.

rotated

logical: if FALSE the plotted diagram has axes (birth, death), if TRUE the plotted diagram has axes ((birth+death)/2,(death-birth)/2). The default value is FALSE.

barcode

logical: if TRUE the persistence barcode is plotted, in place of the diagram.

band

numeric: if band!=NULL, a pink band of size band is added around the diagonal. If also barcode is TRUE, then bars shorter than band are dotted. The default value is NULL.

lab.line

number of lines from the plot edge, where the labels will be placed. The default value is 2.2.

colorBand

the color for filling the confidence band. The default value is "pink". (NA leaves the band unfilled)

colorBorder

the color to draw the border of the confidence band. The default value is NA and omits the border.

add

logical: if TRUE, the points of x are added to an existing plot.

...

additional graphical parameters.

Author(s)

Fabrizio Lecci

References

Brittany T. Fasy, Fabrizio Lecci, Alessandro Rinaldo, Larry Wasserman, Sivaraman Balakrishnan, and Aarti Singh. (2013), "Statistical Inference For Persistent Homology", (arXiv:1303.7117). To appear, Annals of Statistics.

Frederic Chazal, Brittany T. Fasy, Fabrizio Lecci, Alessandro Rinaldo, and Larry Wasserman, (2014), "Stochastic Convergence of Persistence Landscapes and Silhouettes", Proceedings of the 30th Symposium of Computational Geometry (SoCG). (arXiv:1312.0308)

See Also

alphaComplexDiag, alphaComplexDiag, gridDiag, ripsDiag

Examples

XX1 <- circleUnif(30)
XX2 <- circleUnif(30, r = 2) + 3
XX <- rbind(XX1, XX2)

DiagLim <- 5
maxdimension <- 1

## rips diagram
Diag <- ripsDiag(XX, maxdimension, DiagLim, printProgress = TRUE)

#plot
par(mfrow = c(1, 3))
plot(Diag[["diagram"]])
plot(Diag[["diagram"]], rotated = TRUE)
plot(Diag[["diagram"]], barcode = TRUE)

TDA documentation built on Feb. 16, 2023, 6:35 p.m.