Plot

org.appliedtopology.tda4j.plot.Plot
See thePlot companion trait
object Plot

The plots of persistent homology. Every function returns a Figure (or a Scene for 3-D) to view(), save(...), or adjust (copy(title = ...), + mark, over).

Homological degree k always has the palette's slot k and its own marker shape, so a degree keeps its color and shape from plot to plot whichever degrees are shown. Anything that takes a diagram also takes a list of bars.

Attributes

Companion
trait
Experimental
true
Source
Plot.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Plot.type

Members list

Type members

Types

type Bars = PersistenceDiagram[_] | Seq[PersistenceBar[Double, _]]

A diagram or a list of bars.

A diagram or a list of bars.

Attributes

Source
Plot.scala
type Cycles = IndexedSeq[Seq[(Simplex[Int], Double)]]

The cycles of a list of bars, one per bar, as simplices with their coefficients: what the facades keep of a result's representatives.

The cycles of a list of bars, one per bar, as simplices with their coefficients: what the facades keep of a result's representatives.

Attributes

Source
Plot.scala
type Terms[CellT] = Chain[CellT, _] | Seq[(CellT, Double)]

A representative: a chain, or its cells with their coefficients as numbers (any real cochain of your own, or the cells and coefficients of a saved result).

A representative: a chain, or its cells with their coefficients as numbers (any real cochain of your own, or the cells and coefficients of a saved result).

Attributes

Source
Plot.scala

Value members

Concrete methods

def barcode(bars: Bars, title: String = ..., longest: Option[Int] = ..., palette: Optional[Palette] = ..., order: BarOrder = ...)(using look: Look): Figure

The barcode: one horizontal bar per class from its birth to its death, grouped by degree (lowest on top), each group sorted by birth. An essential bar runs off the right edge, marked ∞. Hover a bar for its numbers.

The barcode: one horizontal bar per class from its birth to its death, grouped by degree (lowest on top), each group sorted by birth. An essential bar runs off the right edge, marked ∞. Hover a bar for its numbers.

Value parameters

longest

show only the n most persistent bars of each degree (a cloud's thousand short H0 bars hide everything else).

order

how the bars of a degree are sorted: by birth (the default), longest first, or by death.

Attributes

Source
Plot.scala
def circularCoordinates(points: PointCloud, theta: Map[Int, Double], title: String = ...)(using look: Look): Figure

Circular coordinates (CircularCoordinates.compute(...).theta, angles as fractions of a turn) on the points, on a cyclic color map: points of one color are at one angle, and the colors go round once along the loop. Points with no coordinate (another connected component) are drawn hollow-gray.

Circular coordinates (CircularCoordinates.compute(...).theta, angles as fractions of a turn) on the points, on a cyclic color map: points of one color are at one angle, and the colors go round once along the loop. Points with no coordinate (another connected component) are drawn hollow-gray.

Attributes

Source
Plot.scala
def cocycle(points: PointCloud, chain: Terms[Simplex[Int]], at: Optional[Double] = ..., title: String = ...)(using look: Look): Figure

A simplicial cocycle over its point cloud: each edge (or vertex, triangle) with a nonzero value, colored by that value on the palette's diverging pair (negative one way, positive the other; for Z/p, the balanced representative). A 1-cocycle's edges cut across the loop it detects.

A simplicial cocycle over its point cloud: each edge (or vertex, triangle) with a nonzero value, colored by that value on the palette's diverging pair (negative one way, positive the other; for Z/p, the balanced representative). A 1-cocycle's edges cut across the loop it detects.

A bar's cocycle is a cocycle of the complex where the bar dies, so it has long edges right across the data; at restricts it to the cells of diameter at most at (its restriction to the Vietoris-Rips complex there, still a representative for at inside the bar). at = bar.birth shows the few edges that cut the loop as it closes.

Attributes

Source
Plot.scala
def complex(points: PointCloud, stream: CellStream[Simplex[Int], Double], at: Double, ballRadius: Option[Double] = ..., title: String = ..., palette: Optional[Palette] = ...)(using look: Look): Figure

The cells of stream with filtration value at most at, over the points they are built on: triangles filled, edges and vertices drawn. With ballRadius, the balls around the points too (the union whose nerve the complex approximates).

The cells of stream with filtration value at most at, over the points they are built on: triangles filled, edges and vertices drawn. With ballRadius, the balls around the points too (the union whose nerve the complex approximates).

Attributes

Source
Plot.scala
def complex(points: PointCloud, at: Double, kind: PointCloudComplex)(using look: Look): Figure

The complex kind (VietorisRips, Cech or AlphaShapes) of points at scale at, with the balls whose overlaps it records: radius at / 2 for Vietoris-Rips (an edge enters at the distance of its points), at for Cech and alpha (values are radii).

The complex kind (VietorisRips, Cech or AlphaShapes) of points at scale at, with the balls whose overlaps it records: radius at / 2 for Vietoris-Rips (an edge enters at the distance of its points), at for Cech and alpha (values are radii).

Attributes

Source
Plot.scala
def complex(points: PointCloud, at: Double)(using look: Look): Figure

The Vietoris-Rips complex of points at at, with balls of radius at / 2.

The Vietoris-Rips complex of points at at, with balls of radius at / 2.

Attributes

Source
Plot.scala
def complex3D(points: PointCloud, stream: CellStream[Simplex[Int], Double], at: Double, title: String = ...)(using look: Look): Scene

The cells of stream with value at most at in 3-D: triangles translucent, edges, vertices.

The cells of stream with value at most at in 3-D: triangles translucent, edges, vertices.

Attributes

Source
Plot.scala
def complex3D(points: PointCloud, at: Double, kind: PointCloudComplex)(using look: Look): Scene

The complex kind (VietorisRips, Cech or AlphaShapes) of points at at, in 3-D.

The complex kind (VietorisRips, Cech or AlphaShapes) of points at at, in 3-D.

Attributes

Source
Plot.scala
def cubicalChain(img: Image, chain: Terms[Cube], title: String = ...)(using look: Look): Figure

A chain of cubes (a cycle or cocycle of an image's diagram) drawn over the image: edges as thick segments, vertices as dots, squares filled; coefficients in the tooltips. Its degree's color, gold on the teal ramp in the brand palette.

A chain of cubes (a cycle or cocycle of an image's diagram) drawn over the image: edges as thick segments, vertices as dots, squares filled; coefficients in the tooltips. Its degree's color, gold on the teal ramp in the brand palette.

Attributes

Source
Plot.scala
def cycle(points: PointCloud, chain: Terms[Simplex[Int]], title: String = ...)(using look: Look): Figure

A simplicial cycle (a bar's representative) over the point cloud it lives on: its edges thick in its degree's color, its triangles filled, its vertices dotted; each cell's coefficient in its tooltip. Draw it over complex(...) with over to see it in context.

A simplicial cycle (a bar's representative) over the point cloud it lives on: its edges thick in its degree's color, its triangles filled, its vertices dotted; each cell's coefficient in its tooltip. Draw it over complex(...) with over to see it in context.

Attributes

Source
Plot.scala
def cycle3D(points: PointCloud, chain: Terms[Simplex[Int]], title: String = ...)(using look: Look): Scene

A simplicial representative in 3-D, over its point cloud: edges thick, triangles filled, in its degree's color.

A simplicial representative in 3-D, over its point cloud: edges thick, triangles filled, in its degree's color.

Attributes

Source
Plot.scala
def diagram(bars: Bars, title: String = ..., palette: Optional[Palette] = ...)(using look: Look): Figure

The persistence diagram: a point (birth, death) per bar, colored and shaped by degree, above the diagonal (which is drawn, with the region below it shaded, where the legend sits at the lower right). Essential classes sit on the line marked ∞ at the top. Points far from the diagonal are the persistent features.

The persistence diagram: a point (birth, death) per bar, colored and shaped by degree, above the diagonal (which is drawn, with the region below it shaded, where the legend sits at the lower right). Essential classes sit on the line marked ∞ at the top. Points far from the diagonal are the persistent features.

Attributes

Source
Plot.scala
def explore(bars: Bars, barcode: Boolean = ..., title: String = ..., palette: Optional[Palette] = ...)(using look: Look): Interactive

Persistence bars to explore: the diagram, the barcode and, given the point cloud they were computed on, the cloud itself, linked so that pointing at a class in one lights it up in the others. Pointing at a point of the diagram or a bar of the barcode lights up the same class in the other, and draws its representative cycle on the cloud; a click keeps it chosen (shift-click adds more, a click on the background lets them go), and the page lists what is chosen under the pictures. The pictures are those of diagram and barcode, so everything that tweaks them (+ Palette.named("okabe-ito")) tweaks these.

Persistence bars to explore: the diagram, the barcode and, given the point cloud they were computed on, the cloud itself, linked so that pointing at a class in one lights it up in the others. Pointing at a point of the diagram or a bar of the barcode lights up the same class in the other, and draws its representative cycle on the cloud; a click keeps it chosen (shift-click adds more, a click on the background lets them go), and the page lists what is chosen under the pictures. The pictures are those of diagram and barcode, so everything that tweaks them (+ Palette.named("okabe-ito")) tweaks these.

The page is one selection called class (classes); its keys are the positions of the bars in bars, and tda4j.selection("class") gives them to your own script. Interactive.at(PageState().select("class", 3)) is the still picture of a class chosen.

The cycles are the bars' representatives (the default of Persistence records cycles; cocycles are drawn as they are). Each cell of each cycle is on the page: with maxCycleCells, those of the most persistent bars first fill it, and the rest of the bars light up in the diagram and barcode but draw no cycle.

This is the diagram and the barcode; exploreOn adds the point cloud, with the cycle of the class chosen.

Value parameters

barcode

whether to include the barcode

title

the heading of the page

Attributes

Source
Plot.scala
def exploreOn(points: PointCloud, bars: Bars, barcode: Boolean = ..., maxCycleCells: Int = ..., title: String = ..., palette: Optional[Palette] = ..., cycles: Optional[Cycles] = ...)(using look: Look): Interactive

explore with the point cloud the bars were computed on beside the diagram and the barcode, and the representative cycle of each class drawn on it while the class is chosen.

explore with the point cloud the bars were computed on beside the diagram and the barcode, and the representative cycle of each class drawn on it while the class is chosen.

Value parameters

cycles

the cycle of each bar (bar k's as simplices with coefficients), for bars that carry no representative of their own; used in place of the bars' representatives when given

maxCycleCells

the most cells of cycles to put on the page

points

the point cloud the simplices of the representatives are on

Attributes

Source
Plot.scala
def filtration(points: PointCloud, kind: PointCloudComplex = ..., max: Optional[Double] = ..., start: Optional[Double] = ..., balls: Boolean = ..., barcode: Boolean = ..., stops: Boolean = ..., maxCells: Int = ..., title: String = ..., palette: Optional[Palette] = ..., link: Boolean = ..., canvas: Optional[Boolean] = ...)(using look: Look): Interactive

The complex kind (VietorisRips, Cech or AlphaShapes) of points as an Interactive page with a slider for the scale: the complex and its persistence diagram, with balls around the points. Degrees 0 and 1 are computed, which is what the triangles (2-cells) show; see filtrationOf for the parameters, and for a complex or a diagram of your own.

The complex kind (VietorisRips, Cech or AlphaShapes) of points as an Interactive page with a slider for the scale: the complex and its persistence diagram, with balls around the points. Degrees 0 and 1 are computed, which is what the triangles (2-cells) show; see filtrationOf for the parameters, and for a complex or a diagram of your own.

Value parameters

balls

whether to draw the balls whose overlaps the complex records

max

the largest scale; the points' enclosing radius for the complexes that stop there when not given

Attributes

Source
Plot.scala
def filtration3D(points: PointCloud, kind: PointCloudComplex = ..., max: Optional[Double] = ..., start: Optional[Double] = ..., balls: Boolean = ..., barcode: Boolean = ..., stops: Boolean = ..., maxCells: Int = ..., title: String = ..., palette: Optional[Palette] = ..., link: Boolean = ...)(using look: Look): Interactive

filtration with the complex in 3-D: the complex kind of points (their first three coordinates), a canvas to turn and zoom whose triangles and edges come and go with the slider and whose balls grow with it, beside the diagram. See filtration for the parameters.

filtration with the complex in 3-D: the complex kind of points (their first three coordinates), a canvas to turn and zoom whose triangles and edges come and go with the slider and whose balls grow with it, beside the diagram. See filtration for the parameters.

Attributes

Source
Plot.scala
def filtration3DOf(points: PointCloud, stream: CellStream[Simplex[Int], Double], bars: Bars, balls: Optional[Double] = ..., max: Optional[Double] = ..., start: Optional[Double] = ..., barcode: Boolean = ..., stops: Boolean = ..., maxCells: Int = ..., title: String = ..., palette: Optional[Palette] = ..., link: Boolean = ..., cycles: Optional[Cycles] = ...)(using look: Look): Interactive

filtrationOf with the complex in 3-D (the first three coordinates of the points): a canvas to turn and zoom, whose triangles and edges come and go with the slider and whose balls grow with it, beside the diagram. With link, the views are linked as in filtrationOf: pointing at a class of the diagram or the barcode lights it up in the other and draws its cycle in the canvas.

filtrationOf with the complex in 3-D (the first three coordinates of the points): a canvas to turn and zoom, whose triangles and edges come and go with the slider and whose balls grow with it, beside the diagram. With link, the views are linked as in filtrationOf: pointing at a class of the diagram or the barcode lights it up in the other and draws its cycle in the canvas.

Attributes

Source
Plot.scala
def filtrationOf(points: PointCloud, stream: CellStream[Simplex[Int], Double], bars: Bars, balls: Optional[Double] = ..., max: Optional[Double] = ..., start: Optional[Double] = ..., barcode: Boolean = ..., stops: Boolean = ..., maxCells: Int = ..., title: String = ..., palette: Optional[Palette] = ..., link: Boolean = ..., cycles: Optional[Cycles] = ..., canvas: Optional[Boolean] = ...)(using look: Look): Interactive

The complex of stream over points as an Interactive page: a slider for the filtration value t that adds the edges and triangles as it passes their values (and grows the balls), beside the persistence diagram of bars, where each class is a vertical segment from the diagonal until the movable line passes its death, and then a point.

The complex of stream over points as an Interactive page: a slider for the filtration value t that adds the edges and triangles as it passes their values (and grows the balls), beside the persistence diagram of bars, where each class is a vertical segment from the diagonal until the movable line passes its death, and then a point.

The page holds every cell up to the slider's maximum, so a large complex makes a large page: it refuses more than maxCells of them, and the remedy is a smaller max. Up to 20,000 cells the complex is an SVG with axes, one element per cell; above that it is a canvas (a flat picture you pan and zoom, with no axes), which takes a seventh of the bytes and a hundredth of the elements.

Value parameters

balls

the radius of the balls around the points as a multiple of the filtration value (0.5 for Vietoris-Rips, where an edge enters at its length; 1 for Cech and alpha); none draws no balls

barcode

a third panel, the barcode, with its movable line

canvas

draw the complex on a canvas (true) or as an SVG with axes (false); by default the canvas for more than 20,000 cells

cycles

with link, the cycle of each bar (bar k's as simplices with coefficients) for bars that carry no representative of their own; used in place of the bars' representatives when given

link

link the views as explore does: pointing at a class of the diagram or the barcode lights it up in the other, and draws its representative cycle on the complex (the bars must carry representatives, which the default of Persistence does)

max

the largest value of the slider; the largest value in stream when not given

maxCells

the most edges and triangles to put on the page

start

where the slider starts; at 0 (just the points) when not given

stops

whether the slider steps through exactly the values at which a cell enters, instead of sliding smoothly

title

the heading of the page

Attributes

Source
Plot.scala
def grid(grid: CubicalGridStream, title: String = ..., palette: Optional[Palette] = ...)(using look: Look): Figure

A 2-D cubical grid's top-cell values, as image draws an image (in the grid's own, sublevel, units).

A 2-D cubical grid's top-cell values, as image draws an image (in the grid's own, sublevel, units).

Attributes

Source
Plot.scala
def image(img: Image, title: String = ..., palette: Optional[Palette] = ...)(using look: Look): Figure

A 2-D image (row 0 on top) on the sequential ramp; masked (NaN) and infinite pixels left blank.

A 2-D image (row 0 on top) on the sequential ramp; masked (NaN) and infinite pixels left blank.

Attributes

Source
Plot.scala
def landscape(bars: Bars, degree: Int, levels: Int = ..., resolution: Int = ...)(using look: Look): Figure

The first levels persistence landscapes of the bars of degree degree (Vectorization.landscape).

The first levels persistence landscapes of the bars of degree degree (Vectorization.landscape).

Attributes

Source
Plot.scala
def layout(rows: Int, cols: Int, width: Int = ..., height: Int = ..., gap: Int = ..., widths: Optional[Seq[Double]] = ..., heights: Optional[Seq[Double]] = ...): Board

An empty board on a grid of rows by cols cells, in a drawing width by height pixels, to fill with place(figure, row, col, rowSpan, colSpan). A panel can span cells, so that one plot runs across a whole row or column. The columns are equal unless widths gives relative sizes (Seq(1, 3)), and so the rows with heights.

An empty board on a grid of rows by cols cells, in a drawing width by height pixels, to fill with place(figure, row, col, rowSpan, colSpan). A panel can span cells, so that one plot runs across a whole row or column. The columns are equal unless widths gives relative sizes (Seq(1, 3)), and so the rows with heights.

Plot.layout(2, 3)
 .place(Plot.diagram(d), 0, 0, colSpan = 2)
 .place(Plot.barcode(d), 0, 2)
 .place(Plot.landscape(d, 1), 1, 0, colSpan = 3)

Attributes

Source
Plot.scala
def number[C](x: C)(using f: is[C, Field]): Double

A field element as a number: the field's own view of it (Field.toDouble): the value for the reals, the balanced representative for Z/p, NaN when there is none.

A field element as a number: the field's own view of it (Field.toDouble): the value for the reals, the balanced representative for Z/p, NaN when there is none.

Attributes

Source
Plot.scala
def persistenceImage(image: Array[Array[Double]], birthRange: (Double, Double), persistenceRange: (Double, Double), title: String = ..., palette: Optional[Palette] = ...)(using look: Look): Figure

A persistence image (Vectorization.persistenceImage's image(r)(c): r along birthRange, c along persistenceRange) as a heatmap on the palette's sequential ramp.

A persistence image (Vectorization.persistenceImage's image(r)(c): r along birthRange, c along persistenceRange) as a heatmap on the palette's sequential ramp.

Attributes

Source
Plot.scala
def persistenceImage(bars: Bars, degree: Int)(using look: Look): Figure

The persistence image of the finite bars of degree degree, resolution pixels a side, sigma (default: a tenth of the largest persistence) as Vectorization.persistenceImage computes it.

The persistence image of the finite bars of degree degree, resolution pixels a side, sigma (default: a tenth of the largest persistence) as Vectorization.persistenceImage computes it.

Attributes

Source
Plot.scala
def persistenceImage(bars: Bars, degree: Int, resolution: Int, sigma: Double)(using look: Look): Figure

As persistenceImage(bars, degree), with the resolution and sigma chosen.

As persistenceImage(bars, degree), with the resolution and sigma chosen.

Attributes

Source
Plot.scala
def points(points: PointCloud, title: String = ..., palette: Optional[Palette] = ...)(using look: Look): Figure

A point cloud (its first two coordinates).

A point cloud (its first two coordinates).

Attributes

Source
Plot.scala
def points3D(points: PointCloud, title: String = ...)(using look: Look): Scene

A point cloud in 3-D (its first three coordinates), to turn and zoom.

A point cloud in 3-D (its first three coordinates), to turn and zoom.

Attributes

Source
Plot.scala
def side(figures: Figure*): Board

Figures side by side in one row.

Figures side by side in one row.

Attributes

Source
Plot.scala
def torus(theta1: Map[Int, Double], theta2: Map[Int, Double], title: String = ...)(using look: Look): Figure

Two circular coordinates against each other, on the torus [0, 1) x [0, 1) (CircularCoordinates.computeToroidal gives one map per class): points tracing a closed curve that wraps the square are a torus knot of the data.

Two circular coordinates against each other, on the torus [0, 1) x [0, 1) (CircularCoordinates.computeToroidal gives one map per class): points tracing a closed curve that wraps the square are a torus knot of the data.

Attributes

Source
Plot.scala
def viewWith[A](target: Plot => Unit)(body: => A): A

Runs body with every plot it view()s handed to target instead of the live viewer. For a program that hosts the library and has its own place for a plot (a notebook cell, a page that runs a REPL): target gets the plot itself, and shows plot.html(), plot.fragment() or plot.svg() where it likes.

Runs body with every plot it view()s handed to target instead of the live viewer. For a program that hosts the library and has its own place for a plot (a notebook cell, a page that runs a REPL): target gets the plot itself, and shows plot.html(), plot.fragment() or plot.svg() where it likes.

val pages = collection.mutable.ArrayBuffer.empty[String]
Plot.viewWith(plot => pages += plot.html()) { runTheUsersLine() }

It holds on the thread that runs body and on threads started from it, and ends with body; a viewWith inside another takes the plots of its own body.

Attributes

Source
Plot.scala

Concrete fields

val classes: String

The name of the selection that links the views of explore and of a linked filtration: its keys are the positions of the bars in the list or diagram given.

The name of the selection that links the views of explore and of a linked filtration: its keys are the positions of the bars in the list or diagram given.

Attributes

Source
Plot.scala