org.appliedtopology.tda4j.plot

Members list

Type members

Experimental classlikes

enum Anchor

Attributes

Experimental
true
Source
Figure.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Axis(label: String = ..., min: Option[Double] = ..., max: Option[Double] = ..., ticks: Ticks = ..., extra: IndexedSeq[(Double, String)] = ..., grid: Boolean = ..., visible: Boolean = ..., transform: Transform = ..., format: Option[String] = ..., minusInfinity: Option[Boolean] = ..., side: Option[Side] = ..., reverse: Boolean = ..., padding: Option[Double] = ..., crossesAt: Option[Double] = ...)

One axis. min and max fix the ends of the visible range in data units (otherwise the marks' extent, padded); transform is the scale the data are drawn on; ticks chooses the tick positions and extra adds labelled ones (the ∞ mark); format is a printf pattern for the numbers; visible = false drops ticks, labels and baseline (a point cloud's frame). On a log axis what is at 0 (an H0 bar's birth) sits on a -∞ line below the lowest number, as an essential bar ends at ∞: minusInfinity = None draws the line when something is there, Some(true) always (panels that must line up), Some(false) never, leaving what is at 0 out and counting it. reverse runs the axis the other way (large values at the left, or at the bottom); padding is the fraction of the data's extent left empty at each end when the range is not fixed (default 0.04). side puts the axis on the other side of the plot (an x axis at the Top, a y axis at the Right). crossesAt draws the axis where the other axis has that value (an x axis through y = 0, a y axis through x = 0), in the data units of the other axis, with the numbers beside it and the label at the edge; a value the other axis does not show leaves the axis at the edge. Change an axis of a figure with Scale.x(...) and Labels(x = ...).

One axis. min and max fix the ends of the visible range in data units (otherwise the marks' extent, padded); transform is the scale the data are drawn on; ticks chooses the tick positions and extra adds labelled ones (the ∞ mark); format is a printf pattern for the numbers; visible = false drops ticks, labels and baseline (a point cloud's frame). On a log axis what is at 0 (an H0 bar's birth) sits on a -∞ line below the lowest number, as an essential bar ends at ∞: minusInfinity = None draws the line when something is there, Some(true) always (panels that must line up), Some(false) never, leaving what is at 0 out and counting it. reverse runs the axis the other way (large values at the left, or at the bottom); padding is the fraction of the data's extent left empty at each end when the range is not fixed (default 0.04). side puts the axis on the other side of the plot (an x axis at the Top, a y axis at the Right). crossesAt draws the axis where the other axis has that value (an x axis through y = 0, a y axis through x = 0), in the data units of the other axis, with the numbers beside it and the label at the edge; a value the other axis does not show leaves the axis at the edge. Change an axis of a figure with Scale.x(...) and Labels(x = ...).

Attributes

Experimental
true
Source
Figure.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum BarOrder

How the bars of one degree are ordered in a barcode, top to bottom.

How the bars of one degree are ordered in a barcode, top to bottom.

Attributes

Companion
object
Experimental
true
Source
Plot.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object BarOrder

Attributes

Companion
enum
Experimental
true
Source
Plot.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
BarOrder.type
enum Behavior

What a control does to the item it is attached to. A behavior is a small value: attach one or several (a + b) to a mark of a Panel, and the page shows the item accordingly whenever the control moves; the same behaviors give a still picture at any value of the control (Interactive.at), which is how a talk's frames are made.

What a control does to the item it is attached to. A behavior is a small value: attach one or several (a + b) to a mark of a Panel, and the page shows the item accordingly whenever the control moves; the same behaviors give a still picture at any value of the control (Interactive.at), which is how a talk's frames are made.

  • Behavior.Shown: the item is there while the control's value v has from <= v < until. A simplex that enters the filtration at f is shown from f; a class that lives on [b, d) is shown from b until d.
  • Behavior.Follows: a coordinate of the item (of one or both ends of a segment, or of a rule) is the control's value held between lo and hi. A rule that follows the control is the movable line; a segment that follows it between b and d is a bar growing until the line passes its death. In a 3-D scene a point, a segment, a triangle or a ball follows too, in any of the three coordinates, and the scene keeps its place in the picture (see Panel.Spatial).
  • Behavior.Radius: the radius of the discs of a mark (data units) is factor times the control's value: the balls whose overlaps a Vietoris-Rips or Cech complex records.
  • Behavior.Selects: pointing at the item (or clicking it) chooses a key of a Selection. What the item looks like does not change; other items react.
  • Behavior.Selected: the item is there while a key is chosen in a Selection: a ring around a point, a cycle over the input. Together with Behavior.Selects on the item that stands for the same thing in another panel, this links the views.
  • Behavior.Custom: your own. The page calls the function you register under kind (see Interactive.withScript); a still picture shows the item as it was drawn.

Attributes

Companion
object
Experimental
true
Source
Interactive.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Behavior

Attributes

Companion
enum
Experimental
true
Source
Interactive.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Behavior.type
object Board

Attributes

Companion
class
Experimental
true
Source
Plot.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Board.type
final case class Board(plots: Seq[Figure], title: String = ..., layout: Option[Layout] = ..., slots: Seq[Slot] = ..., heading: String = ...) extends Plot

Plots side by side, in one row (small multiples: a barcode next to its diagram, a complex at several scales), or on a Layout grid, where a panel can span several rows and columns (Plot.layout(2, 3).place(...)).

Plots side by side, in one row (small multiples: a barcode next to its diagram, a complex at several scales), or on a Layout grid, where a panel can span several rows and columns (Plot.layout(2, 3).place(...)).

Value parameters

heading

a title drawn above the panels, set with Labels(title = ...); title is the page's own and is drawn only as this

layout

the grid the panels are placed on; none for a row

slots

where each of plots sits on layout, in the same order

Attributes

Companion
object
Experimental
true
Source
Plot.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Plot
class Object
trait Matchable
class Any
Show all
object Camera

The camera of a 3-D scene: where it looks from, azimuth around the vertical axis and elevation above the horizon (both in degrees), and how close, zoom (1 is the default, 2 shows the scene twice as large). A page's canvas starts from this view and can still be turned and zoomed; a saved .svg is this one view. Only what is given changes. A 2-D figure has no camera and refuses it.

The camera of a 3-D scene: where it looks from, azimuth around the vertical axis and elevation above the horizon (both in degrees), and how close, zoom (1 is the default, 2 shows the scene twice as large). A page's canvas starts from this view and can still be turned and zoomed; a saved .svg is this one view. Only what is given changes. A 2-D figure has no camera and refuses it.

Attributes

Experimental
true
Source
ElementTweaks.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Camera.type
final case class Chrome(surface: String, ink: String, secondary: String, muted: String, grid: String, axis: String)

Chart chrome of one mode: the surface, three inks, gridline and axis.

Chart chrome of one mode: the surface, three inks, gridline and axis.

Attributes

Experimental
true
Source
Color.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class ColorScale(ramp: Ramp = ..., lo: Double = ..., hi: Double = ..., label: String = ..., transform: Transform = ..., stops: Option[IndexedSeq[String]] = ..., guide: Boolean = ...)

How the data values of Paint.Value marks become colors: the figure's one continuous color scale, and the color bar drawn from it.

How the data values of Paint.Value marks become colors: the figure's one continuous color scale, and the color bar drawn from it.

Marks hold the values, not the colors, so the colors follow the figure's Palette and can be re-limited (Scale.color(min = 0, max = 10)) to put two figures on one scale. A Diverging scale is symmetric: lo = -hi. A Cyclic scale reads its values as turns, 0 and 1 being the same color.

Value parameters

guide

whether to draw the color bar

hi

the value of the high end

label

the color bar's title

lo

the value of the low end of the ramp

stops

the colors of a Sequential ramp, light to dark, instead of the palette's own (for example ColorScale.viridis); evenly spaced and mixed in OKLab

transform

how values are spread along a Sequential ramp (Transform.Sqrt for a heavy-tailed image); the other ramps are always linear. A Log10 scale that starts at 0 or below is a symmetric log, linear within a thousandth of its largest magnitude, so that every value has a color

Attributes

Companion
object
Experimental
true
Source
ColorScale.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ColorScale

Attributes

Companion
class
Experimental
true
Source
ColorScale.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ColorScale.type
object Control

Attributes

Companion
class
Experimental
true
Source
Interactive.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Control.type
final case class Control(name: String, min: Double, max: Double, value: Double, label: String = ..., stops: Vector[Double] = ..., step: Option[Double] = ..., play: Option[Double] = ...)

A number the viewer can set: a slider with a name, a range and a starting value, which behaviors refer to by name.

A number the viewer can set: a slider with a name, a range and a starting value, which behaviors refer to by name.

Value parameters

label

what the page writes beside it (ε); the name when empty

name

what behaviors call it (a letter, then letters, digits, _ or -)

play

when given, a play button sweeps from the value the slider is at to max in this many seconds

step

the grid of a smooth slider: a thousandth of the range when not given

stops

when given, the slider steps through exactly these values (the values at which the picture changes), in order, and the arrow keys move from one to the next; otherwise it runs smoothly from min to max

Attributes

Companion
object
Experimental
true
Source
Interactive.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Coordinate

Which coordinate of an item a Behavior.Follows moves: X and Y in a picture, and Z as well in a 3-D scene (the data's coordinates, not the screen's).

Which coordinate of an item a Behavior.Follows moves: X and Y in a picture, and Z as well in a 3-D scene (the data's coordinates, not the screen's).

Attributes

Experimental
true
Source
Interactive.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Dash

Attributes

Companion
enum
Experimental
true
Source
Elements.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Dash.type
enum Dash(val pattern: Option[String])

How a line is dashed.

How a line is dashed.

Attributes

Companion
object
Experimental
true
Source
Elements.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class DegreeStyle(color: Option[String] = ..., darkColor: Option[String] = ..., label: Option[String] = ..., shape: Option[Shape] = ..., marker: MarkerStyle = ...)

What to change about the look of one homological degree (more exactly, one categorical slot: the k-th landscape for Plot.landscape) wherever it appears in a figure: its mark color, its legend label and its marker shape. Whatever is None stays as the palette and the plot have it. marker changes the look of the degree's markers (size, opacity, open or filled, the edge), over the figure's own.

What to change about the look of one homological degree (more exactly, one categorical slot: the k-th landscape for Plot.landscape) wherever it appears in a figure: its mark color, its legend label and its marker shape. Whatever is None stays as the palette and the plot have it. marker changes the look of the degree's markers (size, opacity, open or filled, the edge), over the figure's own.

Value parameters

color

the color in light mode (and dark, unless darkColor is given)

darkColor

the color in dark mode

Attributes

Experimental
true
Source
ColorScale.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Elements

Attributes

Companion
class
Experimental
true
Source
Elements.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Elements.type
final case class Elements(text: Map[TextRole, TextStyle] = ..., grid: LineStyle = ..., minorGrid: LineStyle = ..., axis: LineStyle = ..., ticks: TickStyle = ..., minorTicks: TickStyle = ..., frame: LineStyle = ..., panel: Option[(Paint, Double)] = ..., marker: MarkerStyle = ..., numbers: NumberStyle = ..., legendBox: LegendBox = ...)

The finer-grained look of a figure: what each piece of text, the gridlines, the axis lines, the tick marks, a frame and the plot area's own fill are like, where the plot's Style has only the font, the scales of text and marks, the legend's place and the background.

The finer-grained look of a figure: what each piece of text, the gridlines, the axis lines, the tick marks, a frame and the plot area's own fill are like, where the plot's Style has only the font, the scales of text and marks, the legend's place and the background.

It sits beside the style, not in it, so that a Style added later does not undo it and tweaks of both come in any order. Change it with the Text(...), Lines.grid(...), Lines.ticks(...), Guide.panel(...) tweaks, each of which changes only what it is given.

Value parameters

legendBox

the box round the legend and its columns

marker

what to change about every point's marker (the shape, size, opacity, fill and edge)

numbers

how the numbers of the tick labels and the color bar are written

panel

the fill of the plot area, if it has one

text

the look of each text role that was changed

Attributes

Companion
object
Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Ends

Which end of a segment a Behavior.Follows moves: the first, the second, or both (a rule, a point, a ball and a triangle have one place, or move as a whole, and count as both).

Which end of a segment a Behavior.Follows moves: the first, the second, or both (a rule, a point, a ball and a triangle have one place, or move as a whole, and count as both).

Attributes

Experimental
true
Source
Interactive.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Figure(marks: Vector[Mark] = ..., title: String = ..., subtitle: String = ..., x: Axis = ..., y: Axis = ..., legend: Vector[LegendItem] = ..., colorScale: Option[ColorScale] = ..., width: Int = ..., height: Int = ..., equalAspect: Boolean = ..., aspect: Option[Double] = ..., palette: Palette = ..., style: Style = ..., degrees: Map[Int, DegreeStyle] = ..., legendTitle: String = ..., elements: Elements = ..., legendPlace: LegendPosition = ..., caption: String = ..., tag: String = ..., description: String = ...) extends Plot

A 2-D figure: marks in data coordinates, two axes, a legend, an optional color scale. Immutable: + adds a mark or a Tweak (labels, scales, size, palette, style), ++ more marks, copy changes the rest. svg renders it (Svg); view() shows it live; save("f.svg") writes it.

A 2-D figure: marks in data coordinates, two axes, a legend, an optional color scale. Immutable: + adds a mark or a Tweak (labels, scales, size, palette, style), ++ more marks, copy changes the rest. svg renders it (Svg); view() shows it live; save("f.svg") writes it.

The parts follow the grammar of graphics: the marks are the data drawn, x and y the position scales, palette with degrees and colorScale the color scales, legend and the color bar their guides, style the look and elements its finer parts (each text, the lines, the plot area). legendPlace is where the plot puts its legend unless the style says otherwise. equalAspect keeps a unit of x as long as a unit of y when both axes are on one scale, and aspect is any other ratio of the length of a y unit to an x unit (Scale.aspect). caption is a line of text under the plot, tag the letter of a panel of a board, and description what a screen reader says of the plot (the `` of the SVG).

Attributes

Experimental
true
Source
Figure.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Plot
class Object
trait Matchable
class Any
Show all
object Geom

What to change about how the marks of a plot are drawn, by kind of mark: the points (Geom.points: shape, size, opacity, open or filled, and the edge, which can be removed), the segments (Geom.segments: the bars of a barcode, the edges of a complex), the polygons and discs, and lines. Each changes only what it is given, in every mark of the kind the figure has, and leaves a figure without any as it is:

What to change about how the marks of a plot are drawn, by kind of mark: the points (Geom.points: shape, size, opacity, open or filled, and the edge, which can be removed), the segments (Geom.segments: the bars of a barcode, the edges of a complex), the polygons and discs, and lines. Each changes only what it is given, in every mark of the kind the figure has, and leaves a figure without any as it is:

Plot.diagram(d).withPoints(size = 3.5, opacity = 0.6, edgeVisible = false)
Plot.barcode(d).withSegments(width = 3)

A single degree's markers are changed with Scale.degree(k, marker = MarkerStyle(...)).

Attributes

Experimental
true
Source
Markers.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Geom.type
object Guide

The guides a plot draws for itself, which are not axes or text: the plot area's own fill, and the diagonal of a persistence diagram with its shaded half plane.

The guides a plot draws for itself, which are not axes or text: the plot area's own fill, and the diagonal of a persistence diagram with its shaded half plane.

Attributes

Experimental
true
Source
ElementTweaks.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Guide.type
object Html

A standalone page around a plot fragment: the palette's page background in both modes, the fragment centred.

A standalone page around a plot fragment: the palette's page background in both modes, the fragment centred.

Attributes

Experimental
true
Source
Html.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Html.type
final case class Interactive(panels: Vector[Panel] = ..., controls: Vector[Control] = ..., title: String = ..., scripts: Vector[String] = ..., selections: Vector[Selection] = ...) extends Plot

A plot with controls: a page whose panels respond to sliders, with no library to load. The panels are the plots of the library (a Figure or a Scene) drawn as usual; what changes when a control moves is what the Behaviors of their items say. Like every plot it is an immutable value, built by chaining:

A plot with controls: a page whose panels respond to sliders, with no library to load. The panels are the plots of the library (a Figure or a Scene) drawn as usual; what changes when a control moves is what the Behaviors of their items say. Like every plot it is an immutable value, built by chaining:

Plot.filtration(points) // a complex, its diagram, a slider for the scale
 .withPlay(10)
 .withTitle("Noisy circle")

Interactive()
 .withSlider("t", 0, 1)
 .withPanel(Panel(figure).react(Mark.Points(...), Behavior.shownFrom("t", 0.3)))

The page is one HTML file, and Interactive.at gives the still picture at any value, so the same plot makes the frames of a video or the slides of a talk (frames, saveFrames).

'''Extending it.''' withScript(js) runs your JavaScript on the page with tda4j, the page's controller: tda4j.get(name), tda4j.set(name, value), tda4j.onChange(name, f), and tda4j.reactor(kind, f) to define what a Behavior.Custom of that kind does (f(item, behavior, value), item.el being the SVG element). Every change is also announced as a tda4j:change event on the page's root element, for anything else on the page.

Value parameters

controls

the sliders, top to bottom

panels

what is drawn, left to right and wrapping

scripts

JavaScript to run on the page (see above)

title

the page's heading

Attributes

Companion
object
Experimental
true
Source
Interactive.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Plot
class Object
trait Matchable
class Any
Show all
object Interactive

Attributes

Companion
class
Experimental
true
Source
Interactive.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Labels(title: Optional[String] = ..., subtitle: Optional[String] = ..., x: Optional[String] = ..., y: Optional[String] = ..., legend: Optional[String] = ..., color: Optional[String] = ..., caption: Optional[String] = ..., tag: Optional[String] = ..., description: Optional[String] = ...) extends Tweak

The words of a plot. Only what is given changes; Labels(x = "birth (cm)") leaves the title as it is.

The words of a plot. Only what is given changes; Labels(x = "birth (cm)") leaves the title as it is.

Value parameters

caption

a line of text under the plot

color

the title of the color bar

description

what a screen reader says of the plot, the `` of the SVG

legend

a heading over the legend's entries

subtitle

the line under it

tag

the letter of a panel of a board, in the corner of the figure ("(a)")

title

the heading

x

the x axis label

y

the y axis label

Attributes

Experimental
true
Source
Tweak.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Tweak
class Object
trait Matchable
class Any
Show all
object Layer

Attributes

Companion
trait
Experimental
true
Source
Scene.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Layer.type
sealed trait Layer

What a 3-D scene is made of: points, segments and triangles, each with one paint or one per item; balls around points (translucent discs, as a sphere looks in an orthographic view) and halos (discs of a size in pixels, to ring a point).

What a 3-D scene is made of: points, segments and triangles, each with one paint or one per item; balls around points (translucent discs, as a sphere looks in an orthographic view) and halos (discs of a size in pixels, to ring a point).

Attributes

Companion
object
Experimental
true
Source
Scene.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Balls
class Halos
class Points
class Segments
class Triangles
final case class Layout(rows: Int, cols: Int, width: Int = ..., height: Int = ..., gap: Int = ..., widths: Vector[Double] = ..., heights: Vector[Double] = ...)

A grid of rows by cols cells that a Board fills with panels, in a drawing width by height pixels with gap pixels between cells. The columns share the width in proportion to widths (equal when empty) and the rows the height in proportion to heights; a weight is a relative size, Vector(1, 3) makes the second column three times as wide as the first.

A grid of rows by cols cells that a Board fills with panels, in a drawing width by height pixels with gap pixels between cells. The columns share the width in proportion to widths (equal when empty) and the rows the height in proportion to heights; a weight is a relative size, Vector(1, 3) makes the second column three times as wide as the first.

Attributes

Experimental
true
Source
Layout.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class LegendBox(fill: Option[(Paint, Double)] = ..., frame: LineStyle = ..., padding: Option[Double] = ..., columns: Option[Int] = ...)

The box around a legend and how its entries are arranged, as asked for: nothing is drawn behind a legend unless it has a fill or a visible frame.

The box around a legend and how its entries are arranged, as asked for: nothing is drawn behind a legend unless it has a fill or a visible frame.

Value parameters

columns

the number of columns of entries (1 if not given), filled one column before the next

fill

the background of the box (a paint and its opacity), if it has one

frame

the line round the box

padding

the room between the box and its entries, in pixels before the legend's text scale (6 if not given)

Attributes

Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object LegendItem

Attributes

Companion
class
Experimental
true
Source
Figure.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
LegendItem.type
final case class LegendItem(label: String, paint: Paint, key: Key = ..., shape: Shape = ...)

A legend entry: a key (a dot of the given shape, a line, or a swatch) in paint, and its label.

A legend entry: a key (a dot of the given shape, a line, or a swatch) in paint, and its label.

Attributes

Companion
object
Experimental
true
Source
Figure.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
enum
Experimental
true
Source
Style.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Where a figure's legend goes. Right, Left, Top and Bottom are beside the plot (the sides take the room they need); the four corners are inside the plot area, over its corner, where a plot has room (the lower right of a persistence diagram, below the diagonal).

Where a figure's legend goes. Right, Left, Top and Bottom are beside the plot (the sides take the room they need); the four corners are inside the plot area, over its corner, where a plot has room (the lower right of a persistence diagram, below the diagonal).

Attributes

Companion
object
Experimental
true
Source
Style.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class LineStroke(visible: Boolean, width: Double, paint: Paint, dash: Dash, opacity: Double)

A line as it is drawn: every setting has a value.

A line as it is drawn: every setting has a value.

Attributes

Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class LineStyle(visible: Option[Boolean] = ..., width: Option[Double] = ..., paint: Option[Paint] = ..., dash: Option[Dash] = ..., opacity: Option[Double] = ...)

What to change about the look of a line of the plot (gridlines, an axis line, a tick mark, a frame). Whatever is None stays as the plot has it.

What to change about the look of a line of the plot (gridlines, an axis line, a tick mark, a frame). Whatever is None stays as the plot has it.

Value parameters

paint

a palette role or a color of your own

visible

false to draw none

width

in pixels; the style's markScale does not change it

Attributes

Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Lines

The look of the lines of a plot: gridlines, the axis lines, tick marks, and a frame around the plot area. Each changes only what it is given (width, a color or a palette paint, dash, opacity, visible):

The look of the lines of a plot: gridlines, the axis lines, tick marks, and a frame around the plot area. Each changes only what it is given (width, a color or a palette paint, dash, opacity, visible):

Plot.diagram(d).withGridLines(dash = Dash.Dotted).withTickMarks(length = 4).withFrame()

The minor gridlines, the minor tick marks and the frame are not drawn unless asked: giving any of them a setting turns it on (visible = false turns it off). Tick marks have a length in pixels (0 is none) and a direction, out of the plot or into it; asked for with no length they are 4 pixels, minor ones 2.5. On a log axis the minor ones are the 2 to 9 of each decade; on any other axis the halves between two ticks.

Attributes

Experimental
true
Source
ElementTweaks.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Lines.type
final case class Look(tweaks: Vector[Tweak] = ...)

The starting look of the plots you make: tweaks that every plot constructor (Plot.barcode, Plot.diagram, ...) applies to what it builds, before anything you add yourself, so that Plot.barcode(d) is already in your house style and a tweak added afterwards, or a palette named in the call, wins.

The starting look of the plots you make: tweaks that every plot constructor (Plot.barcode, Plot.diagram, ...) applies to what it builds, before anything you add yourself, so that Plot.barcode(d) is already in your house style and a tweak added afterwards, or a palette named in the call, wins.

A Look is a Scala given, found by the constructors without an import. Put one where the plots are made, such as at the top of a file or a block:

given Look = Look.print + Text(TextRole.Title, size = 18)
Plot.barcode(d).save("barcode.svg") // in the print look

A look is made of the same tweaks as a plot (Palette, Style, Text, Lines, Numbers, ...). A tweak that a kind of plot cannot have is left out for it, so one look serves figures and 3-D scenes alike (the tick labels of a look do nothing to a scene). With no given Look the constructors use Look.none, and a plot is as it was.

The nearest given Look is used whole. To add to the look in scope, ask for it in an inner scope (a block, a method, or a file that imports a shared look): given Look = summon[Look] + Text(TextRole.Title, size = 21).

Attributes

Companion
object
Experimental
true
Source
Look.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Look

Attributes

Companion
class
Experimental
true
Source
Look.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Look.type
sealed trait Mark

What a figure is made of, all in data coordinates. Every mark takes either one paint (for all its items) or one per item, and optionally one tooltip per item (shown on hover, as the SVG `` of the item).

What a figure is made of, all in data coordinates. Every mark takes either one paint (for all its items) or one per item, and optionally one tooltip per item (shown on hover, as the SVG `` of the item).

Attributes

Companion
object
Experimental
true
Source
Figure.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Boxes
class Diagonal
class Discs
class Line
class Points
class Polygons
class Region
class Rule
class Segments
class Text
Show all
object Mark

Attributes

Companion
trait
Experimental
true
Source
Figure.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Mark.type
final case class MarkerFace(shape: Shape, size: Double, opacity: Double, filled: Boolean, edge: LineStroke)

A marker as it is drawn: every setting has a value.

A marker as it is drawn: every setting has a value.

Attributes

Experimental
true
Source
Markers.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object MarkerStyle

Attributes

Companion
class
Experimental
true
Source
Markers.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class MarkerStyle(shape: Option[Shape] = ..., size: Option[Double] = ..., opacity: Option[Double] = ..., fill: Option[Boolean] = ..., edge: LineStyle = ...)

What to change about how markers (the points of a figure) look. Whatever is None stays as the plot has it.

What to change about how markers (the points of a figure) look. Whatever is None stays as the plot has it.

A marker is a shape, drawn filled in the mark's own color or open (fill = false: no inside, an outline in its own color), with an edge: a line around it, by default a ring of 2 pixels in the surface color that keeps overlapping markers apart. The edge has a width (0 for none), a color, an opacity and a dash, and can be removed. A shape that is strokes only (a plus, a cross) is drawn in its own color, as wide as the edge.

Value parameters

edge

the line around the marker (visible, width, paint, dash, opacity): an open marker's or a stroke's own color by default, the surface's for a filled one

fill

false for an open marker

opacity

of the whole marker, 0 to 1

shape

the shape; the plots give each homological degree its own

size

the radius in pixels (before the style's markScale)

Attributes

Companion
object
Experimental
true
Source
Markers.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class NumberStyle(decimal: Option[String] = ..., grouping: Option[String] = ..., minus: Option[String] = ...)

How the numbers of tick labels and color bars are written: the decimal separator, a separator between groups of three digits (none unless given) and the minus sign ("−", the typographic one, is a common wish). Whatever is None stays as it is: ., no grouping, -.

How the numbers of tick labels and color bars are written: the decimal separator, a separator between groups of three digits (none unless given) and the minus sign ("−", the typographic one, is a common wish). Whatever is None stays as it is: ., no grouping, -.

Attributes

Companion
object
Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object NumberStyle

Attributes

Companion
class
Experimental
true
Source
Elements.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object Numbers

How the numbers of the tick labels and the color bar are written: Numbers(decimal = ",", minus = "−") for a German paper, Numbers.locale("de") for what the locale has (its decimal separator and minus sign), grouping = " " to group the digits of a large number in threes. Only what is given changes.

How the numbers of the tick labels and the color bar are written: Numbers(decimal = ",", minus = "−") for a German paper, Numbers.locale("de") for what the locale has (its decimal separator and minus sign), grouping = " " to group the digits of a large number in threes. Only what is given changes.

Attributes

Experimental
true
Source
ElementTweaks.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Numbers.type
final case class PageState(values: Map[String, Double] = ..., selected: Map[String, Set[Int]] = ..., windows: Map[Int, Window] = ..., brushes: Map[Int, Window] = ...)

Where the controls, selections and views of an Interactive page are, for a still picture of it (at): the value of each slider, and the keys chosen in each selection. What a viewer has done on the page, written down.

Where the controls, selections and views of an Interactive page are, for a still picture of it (at): the value of each slider, and the keys chosen in each selection. What a viewer has done on the page, written down.

page.at(PageState().value("t", 0.6).select("class", 3))

Value parameters

brushes

the rectangle dragged out in each brushable panel, by the panel's number (none by default)

selected

the keys chosen in each selection (none by default)

values

the sliders that are not at their starting values

windows

the range of each zoomed panel, by the panel's number (none by default: every panel shows all of its picture)

Attributes

Experimental
true
Source
Selection.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Paint

What a mark is painted with. A Series slot or a role (Ink, Muted, ...) is resolved by the figure's Palette and Theme, so the same figure renders light or dark and in another palette; Value is a data value (a heatmap cell, an angle, a coefficient) that the figure's ColorScale turns into a color, again through its palette; Fixed is a color of your own and is the same everywhere.

What a mark is painted with. A Series slot or a role (Ink, Muted, ...) is resolved by the figure's Palette and Theme, so the same figure renders light or dark and in another palette; Value is a data value (a heatmap cell, an angle, a coefficient) that the figure's ColorScale turns into a color, again through its palette; Fixed is a color of your own and is the same everywhere.

Attributes

Experimental
true
Source
Color.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Palette

Attributes

Companion
class
Experimental
true
Source
Color.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Palette.type
final case class Palette(seriesLight: IndexedSeq[String], seriesDark: IndexedSeq[String], light: Chrome, dark: Chrome, sequential: IndexedSeq[String], divergingNegative: String, divergingPositive: String, divergingMidpoint: String) extends Tweak

Everything a plot's colors come from: categorical slots (light and dark steps of the same hues), chrome for each mode, a sequential ramp (light = small) and a diverging pair. Palette.brand (the default) is TDA4j's Teal & Gold; Palette.reference is the neutral palette of the dataviz method. Make your own with withSeries, withSurface and copy.

Everything a plot's colors come from: categorical slots (light and dark steps of the same hues), chrome for each mode, a sequential ramp (light = small) and a diverging pair. Palette.brand (the default) is TDA4j's Teal & Gold; Palette.reference is the neutral palette of the dataviz method. Make your own with withSeries, withSurface and copy.

A palette is a Tweak: fig + Palette.reference recolors every part of the figure, heatmaps and cocycles included.

Attributes

Companion
object
Experimental
true
Source
Color.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Tweak
class Object
trait Matchable
class Any
Show all
sealed trait Panel

One picture of an interactive plot: a 2-D Figure or a 3-D Scene, and what each of the items of its marks (or layers) does when a control moves. reactions maps the index of a mark (layer) to a Reaction for all its items, or one for each item, like the paints of a mark.

One picture of an interactive plot: a 2-D Figure or a 3-D Scene, and what each of the items of its marks (or layers) does when a control moves. reactions maps the index of a mark (layer) to a Reaction for all its items, or one for each item, like the paints of a mark.

Attributes

Companion
object
Experimental
true
Source
Interactive.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Flat
class Spatial
object Panel

Attributes

Companion
trait
Experimental
true
Source
Interactive.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Panel.type
trait Plot

Anything the viewer can show and save can write: a Figure, a Scene (3-D), a side-by-side Board.

Anything the viewer can show and save can write: a Figure, a Scene (3-D), a side-by-side Board.

Attributes

Companion
object
Experimental
true
Source
Plot.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Board
class Figure
class Interactive
class Scene
class Snapshot
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).

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
Supertypes
class Object
trait Matchable
class Any
Self type
Plot.type
enum Ramp

Which of a Palette's color maps a ColorScale reads.

Which of a Palette's color maps a ColorScale reads.

Sequential is for magnitudes (light to dark), Diverging for signed values (two hues about a neutral middle), and Cyclic for angles (no seam where the end meets the start).

Attributes

Experimental
true
Source
ColorScale.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Reaction(behaviors: Vector[Behavior])

What happens to one item: its behaviors, in order. a + b builds one.

What happens to one item: its behaviors, in order. a + b builds one.

Attributes

Companion
object
Experimental
true
Source
Interactive.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Reaction

Attributes

Companion
class
Experimental
true
Source
Interactive.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Reaction.type
object Scale

Scales: how data become positions, colors and marks. The tweaks that change them:

Scales: how data become positions, colors and marks. The tweaks that change them:

  • Scale.x, Scale.y, Scale.xy: an axis's transform (log, square root), limits, tick positions and number format, gridlines;
  • Scale.color: the limits, the colors and the transform of a color scale (a heatmap, a cocycle's values);
  • Scale.degree: the color, label and marker shape of a homological degree.

Every argument is optional, and only what is given changes.

Attributes

Experimental
true
Source
Tweak.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Scale.type
object Scene

Attributes

Companion
class
Experimental
true
Source
Scene.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Scene.type
final case class Scene(layers: Vector[Layer] = ..., title: String = ..., subtitle: String = ..., width: Int = ..., height: Int = ..., azimuth: Double = ..., elevation: Double = ..., palette: Palette = ..., style: Style = ..., degrees: Map[Int, DegreeStyle] = ..., elements: Elements = ..., zoom: Double = ..., turns: Boolean = ..., fitted: Option[(XYZ, Double)] = ..., region: Option[Window] = ..., axes: Boolean = ..., xAxis: Axis = ..., yAxis: Axis = ...) extends Plot

A 3-D plot. In a page (html, the live viewer) it is drawn on a canvas you can turn (drag) and zoom (scroll), with no library to load; as an .svg file it is one view, from azimuth/elevation (degrees), drawn back to front.

A 3-D plot. In a page (html, the live viewer) it is drawn on a canvas you can turn (drag) and zoom (scroll), with no library to load; as an .svg file it is one view, from azimuth/elevation (degrees), drawn back to front.

With turns = false the view stays as azimuth and elevation give it and a drag pans instead; the scroll wheel zooms about the pointer. A flat picture (points in the plane, seen from above: azimuth = 0, elevation = 90) is drawn this way when it has too many items for an SVG, which a canvas draws in a fraction of the time and bytes.

The scene is fitted into the picture by its points (the centres of balls and halos count, their extent does not). fitted gives the centre and the radius to fit to instead: an interactive page does so for a scene whose items come and go or move with a control, so that the picture stays put (see Interactive).

axes draws an x axis along the foot of the picture and a y axis along its left edge, numbered with the coordinates of the plane at round values as a plot's axes are, for a flat picture (seen from above: azimuth = 0, elevation = 90), with gridlines at the numbers. The picture then keeps to the room inside the axes, and a canvas that pans and zooms numbers its axes again for what it shows. xAxis and yAxis hold what the axes are given by Labels (x, y) and Scale (transform, min, max, padding, breaks, format, grid, visible, reverse): an axis can be linear, log, square-root or symmetric log (Transform.Custom has no ticks a page can draw) and can run the other way, and the picture is then the data after the transforms, drawn at one scale on both axes: a straight segment between two places is a straight line between their positions. min, max and padding give the range the picture opens on (and returns to), widened to the shape of the plot area; without them the picture is fitted to its points.

region is a rectangle drawn over the picture, a translucent fill with a dashed outline, in the units of the view plane: the view from azimuth and elevation (at zoom 1), x to the right and y up, in the radius of the fitted frame. PageState.brush puts it in a still picture of a Panel.Spatial, where it is the rectangle a viewer has dragged out.

Attributes

Companion
object
Experimental
true
Source
Scene.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Plot
class Object
trait Matchable
class Any
Show all
object Selection

Attributes

Companion
class
Experimental
true
Source
Selection.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Selection.type
final case class Selection(name: String, labels: Vector[String] = ..., hover: Boolean = ..., click: Boolean = ..., listed: Boolean = ..., title: String = ...)

A set of things the viewer picks by pointing at them: the classes of a barcode, the points of a cloud. Items of a Panel name a key (a whole number, the index of the thing they stand for) and choose it with Behavior.Selects; other items appear while a key is chosen with Behavior.Selected, so that pointing at a bar of the barcode lights up its point in the diagram and its cycle on the input. A selection is to the viewer's pointer what a Control is to a slider: a named input that behaviors listen to.

A set of things the viewer picks by pointing at them: the classes of a barcode, the points of a cloud. Items of a Panel name a key (a whole number, the index of the thing they stand for) and choose it with Behavior.Selects; other items appear while a key is chosen with Behavior.Selected, so that pointing at a bar of the barcode lights up its point in the diagram and its cycle on the input. A selection is to the viewer's pointer what a Control is to a slider: a named input that behaviors listen to.

Pointing at an item chooses its key for as long as the pointer stays (hover); a click pins it until it is clicked again (a shift-click adds to the pinned keys, a click on the background of a panel lets them all go); a Panel.Flat.brushable panel chooses by dragging a rectangle.

Value parameters

click

whether clicking an item pins it

hover

whether pointing at an item chooses it

labels

what to write for each key, labels(key), in the list under the panels and in the heading of a still picture

listed

whether the page lists the labels of the chosen keys under the panels

name

what behaviors call it (a letter, then letters, digits, _ or -)

title

what the page writes beside that list, and in the heading of a still picture; the name when empty

Attributes

Companion
object
Experimental
true
Source
Selection.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Settings

Changes written as element.property=value text, the way MATLAB, Java and the command line (--set) reach what Text(...), Lines.grid(...), Guide.panel(...) and Scale.x(position = ...) do:

Changes written as element.property=value text, the way MATLAB, Java and the command line (--set) reach what Text(...), Lines.grid(...), Guide.panel(...) and Scale.x(position = ...) do:

Settings.parse("title.size=18")           // Text(TextRole.Title, size = 18)
Settings.parse("tick-label.angle=45")
Settings.parse("grid.dash=dotted")
Settings.parse("ticks.length=4")
Settings.parse("diagonal.shade=none")
Settings.parse("x-axis=top")

The elements are the text roles (title, subtitle, axis-label, tick-label, legend, legend-title, color-title, note) with the properties size, weight, italic, align, angle, font and color; grid, minor-grid, axis-line and frame with visible, width, color, dash, opacity; ticks and minor-ticks with length, direction, visible, width, color, opacity; panel with color, opacity, visible; legend-box with background (a color, or none for no box at all), opacity, frame (a color or none), frame-width, padding and columns; diagonal with shade (none or a color), shade-opacity, color, width, dashed; marker with shape (a name, a matplotlib code, an R pch, glyph:text; see MarkerStyle.named), size, opacity, fill, edge-width (0 for none), edge-color, edge-opacity, edge-dash, edge-visible; degree-0, degree-1, ... with color, dark-color, label and the marker properties; segments (width, opacity), polygons and discs (opacity), lines (width); numbers (locale, decimal, grouping, minus); size (width, height, in pixels or with in, cm, mm, pt); camera (azimuth, elevation, zoom, of a 3-D scene); palette and style alone (palette=print); aspect (1, or free); and x-axis and y-axis, alone (x-axis=top) or with side, reverse, padding, min, max, format, crosses-at (the value of the other axis it goes through).

Attributes

Experimental
true
Source
ElementTweaks.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Settings.type
enum Shape

Marker shapes; the plots give each homological degree its own (the first four, in order), so degree never rests on color alone. Plus, Cross, VLine and HLine are strokes with no inside; Glyph is a few characters of text drawn as the marker (Shape.Glyph("★")), in the marker's color. For a shape written as a string, see Shape.named.

Marker shapes; the plots give each homological degree its own (the first four, in order), so degree never rests on color alone. Plus, Cross, VLine and HLine are strokes with no inside; Glyph is a few characters of text drawn as the marker (Shape.Glyph("★")), in the marker's color. For a shape written as a string, see Shape.named.

Attributes

Companion
object
Experimental
true
Source
Figure.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Shape

Attributes

Companion
enum
Experimental
true
Source
Figure.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Shape.type
object Side

Attributes

Companion
enum
Experimental
true
Source
Elements.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Side.type
enum Side

A side of the plot area: where an axis can sit. An x axis is at the Bottom (the default) or the Top, a y axis at the Left (the default) or the Right.

A side of the plot area: where an axis can sit. An x axis is at the Bottom (the default) or the Top, a y axis at the Left (the default) or the Right.

Attributes

Companion
object
Experimental
true
Source
Elements.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Size

Attributes

Companion
class
Experimental
true
Source
Tweak.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Size.type
final case class Size(width: Optional[Int] = ..., height: Optional[Int] = ...) extends Tweak

The size of a plot in pixels, width by height. Only what is given changes (Size(width = 900)); the plot area takes what the margins leave. The plots choose a height that suits what they draw (a barcode grows with its bars), so give both numbers to fix both.

The size of a plot in pixels, width by height. Only what is given changes (Size(width = 900)); the plot area takes what the margins leave. The plots choose a height that suits what they draw (a barcode grows with its bars), so give both numbers to fix both.

Attributes

Companion
object
Experimental
true
Source
Tweak.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Tweak
class Object
trait Matchable
class Any
Show all
final case class Slot(row: Int, col: Int, rowSpan: Int = ..., colSpan: Int = ...)

Where a panel of a Board sits on its Layout: the row and column of its top left cell (counted from 0) and how many rows and columns it spans. A panel that spans cells is as large as those cells and the gaps between them, so its axes run across all of them.

Where a panel of a Board sits on its Layout: the row and column of its top left cell (counted from 0) and how many rows and columns it spans. A panel that spans cells is as large as those cells and the gaps between them, so its axes run across all of them.

Attributes

Experimental
true
Source
Layout.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Snapshot(parts: Vector[Plot], title: String = ..., heading: String = ..., values: Map[String, Double] = ..., selected: Map[String, Set[Int]] = ...) extends Plot

The still picture of an Interactive at some values of its controls: its panels side by side under a heading that says the values. A plot like any other (save, view, svgFile).

The still picture of an Interactive at some values of its controls: its panels side by side under a heading that says the values. A plot like any other (save, view, svgFile).

Attributes

Experimental
true
Source
Interactive.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Plot
class Object
trait Matchable
class Any
Show all
object Style

Attributes

Companion
class
Experimental
true
Source
Style.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Style.type
final case class Style(font: String = ..., textScale: Double = ..., markScale: Double = ..., grid: Boolean = ..., legend: Optional[LegendPosition] = ..., transparent: Optional[Boolean] = ...) extends Tweak

The look of a figure that is not its data: the font, the size of the text and of the marks, the gridlines, the legend's place and the background. A style says nothing about what is drawn, so one value serves every figure of a paper or a talk: fig + Style.slides.

The look of a figure that is not its data: the font, the size of the text and of the marks, the gridlines, the legend's place and the background. A style says nothing about what is drawn, so one value serves every figure of a paper or a talk: fig + Style.slides.

A style replaces the figure's whole style; to change one setting of a style, Style.slides.copy(grid = false). (Theme is something else: whether colors are light, dark, or follow the reader.)

Value parameters

font

the CSS font-family of every text

grid

false to draw no gridlines on either axis

legend

where the legend goes; unset, a plot has its own place (beside the plot, or at the lower right of a persistence diagram)

markScale

a factor on the size of markers and the width of lines

textScale

a factor on every text size, and on the margins that make room for text

transparent

true to draw no background anywhere, so that the figure takes the color of the page behind it; false to draw the palette's surface everywhere; unset, a figure shown on a page or in the viewer has it (cream, for the default palette) and a saved .svg has none, as a figure deployed elsewhere should take the color of its new page

Attributes

Companion
object
Experimental
true
Source
Style.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Tweak
class Object
trait Matchable
class Any
Show all
object Svg

Renders a Figure as one element: a surface, hairline grid and axes, the marks clipped to the plot area, a legend and a color bar. Under `Theme.Auto` every themed color is a CSS variable of the (both modes declared, prefers-color-scheme choosing); under Light/Dark every color is a plain hex.

Renders a Figure as one element: a surface, hairline grid and axes, the marks clipped to the plot area, a legend and a color bar. Under `Theme.Auto` every themed color is a CSS variable of the (both modes declared, prefers-color-scheme choosing); under Light/Dark every color is a plain hex.

Positions go through the axes' Transforms here and nowhere else, so a figure holds data in its own units. What is at exactly 0 on a log axis sits on a -∞ line beside the lowest number, as an essential bar ends at ∞. A mark with no other place on the axes (a negative value on a log axis, NaN) is left out, and a line of small print under the plot counts what was left out. The figure's Style sets the font, the size of text and marks, the gridlines, the legend's place and the background.

Attributes

Experimental
true
Source
Svg.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Svg.type
object Text

The look of the text of a plot, one TextRole at a time: fig + Text(TextRole.Title, size = 18, align = Anchor.Middle). Only what is given changes, and a later Text of the same role keeps the rest of an earlier one:

The look of the text of a plot, one TextRole at a time: fig + Text(TextRole.Title, size = 18, align = Anchor.Middle). Only what is given changes, and a later Text of the same role keeps the rest of an earlier one:

Plot.diagram(d)
 .withText(TextRole.Title, size = 18, weight = Weight.Bold, align = Anchor.Middle)
 .withText(TextRole.TickLabel, size = 9, angle = 45)

Sizes are in pixels before the style's textScale, so Style.slides still scales them. A role that does not apply (align of a tick label, whose place is its tick's) refuses, naming what to use.

Attributes

Experimental
true
Source
ElementTweaks.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Text.type
final case class TextFace(size: Double, weight: Option[Weight], italic: Boolean, align: Anchor, angle: Double, font: Option[String], paint: Paint, limit: Option[Double] = ...)

A text as it is drawn: every setting has a value (weight and font are None where the plot sets none).

A text as it is drawn: every setting has a value (weight and font are None where the plot sets none).

Attributes

Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum TextRole

The pieces of text of a plot, each of which has a look of its own: a figure's Text(role, size = ...) changes one.

The pieces of text of a plot, each of which has a look of its own: a figure's Text(role, size = ...) changes one.

Title and Subtitle head the plot; AxisLabel names an axis and TickLabel numbers it; Legend is a legend's entries (and a color bar's numbers are TickLabel), LegendTitle its heading, ColorTitle the title of a color bar; Note is the small print under a plot (and a 3-D scene's hint); Caption is the plot's caption under it, and Tag the letter of a panel of a board ("(a)").

Attributes

Companion
object
Experimental
true
Source
Elements.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object TextRole

Attributes

Companion
enum
Experimental
true
Source
Elements.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
TextRole.type
final case class TextStyle(size: Option[Double] = ..., weight: Option[Weight] = ..., italic: Option[Boolean] = ..., align: Option[Anchor] = ..., angle: Option[Double] = ..., font: Option[String] = ..., paint: Option[Paint] = ..., limit: Option[Double] = ...)

What to change about the look of one TextRole. Whatever is None stays as the plot has it.

What to change about the look of one TextRole. Whatever is None stays as the plot has it.

Value parameters

align

where along the plot area the text is: Start (its left edge), Middle or End; for a title, subtitle, axis label and note

angle

degrees counterclockwise: the x axis's tick labels, slanted to fit long labels

font

a CSS font-family list for this text alone

limit

the longest the text may be, in pixels: a longer one is cut and ends in …, with the whole text as its tooltip. The width is estimated letter by letter (TextWidth), as the font the reader sees is not known

paint

a palette role (Paint.Muted) or a color of your own (Paint.Fixed("#333333"))

size

in pixels, before the style's textScale

Attributes

Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object TextWidth

How wide a text is, estimated. The renderer writes SVG for whatever font the reader's browser or tool picks and has no font metrics, so a width is the advance widths of the stock face of a generic family: Helvetica (the faces sans-serif, system-ui, Arial and Liberation Sans stand for), Times (serif) or a fixed width (monospace), letter by letter, so that a row of Ws is wider than a row of is. Exact for those faces and the faces with their metrics (Arial, Liberation Sans, Liberation Serif); a font with other proportions is further off (Inter, which system-ui is on some systems, is about 6% wider).

How wide a text is, estimated. The renderer writes SVG for whatever font the reader's browser or tool picks and has no font metrics, so a width is the advance widths of the stock face of a generic family: Helvetica (the faces sans-serif, system-ui, Arial and Liberation Sans stand for), Times (serif) or a fixed width (monospace), letter by letter, so that a row of Ws is wider than a row of is. Exact for those faces and the faces with their metrics (Arial, Liberation Sans, Liberation Serif); a font with other proportions is further off (Inter, which system-ui is on some systems, is about 6% wider).

Used to cut a long text at a limit (TextFace) and to size a legend.

Attributes

Experimental
true
Source
TextWidth.scala
Supertypes
class Object
trait Matchable
class Any
Self type
TextWidth.type
object Theme

Attributes

Companion
enum
Experimental
true
Source
Color.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Theme.type
enum Theme

Light, dark, or both through the viewer's prefers-color-scheme (Auto: colors are CSS variables, which every browser, notebook and editor preview honours). Use Light for a file that goes into a paper: plain hex colors only.

Light, dark, or both through the viewer's prefers-color-scheme (Auto: colors are CSS variables, which every browser, notebook and editor preview honours). Use Light for a file that goes into a paper: plain hex colors only.

Attributes

Companion
object
Experimental
true
Source
Color.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object TickDirection

Attributes

Companion
enum
Experimental
true
Source
Elements.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Which way the tick marks of an axis point from it: away from the plot, or into it.

Which way the tick marks of an axis point from it: away from the plot, or into it.

Attributes

Companion
object
Experimental
true
Source
Elements.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class TickMarks(length: Double, direction: TickDirection, stroke: LineStroke)

Tick marks as they are drawn: a length in pixels (0 is none), a direction, and the line they are drawn in.

Tick marks as they are drawn: a length in pixels (0 is none), a direction, and the line they are drawn in.

Attributes

Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class TickStyle(length: Option[Double] = ..., direction: Option[TickDirection] = ..., line: LineStyle = ...)

What to change about the tick marks of an axis. length is in pixels, 0 for none.

What to change about the tick marks of an axis. length is in pixels, 0 for none.

Attributes

Experimental
true
Source
Elements.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Ticks

Where an axis puts its ticks.

Where an axis puts its ticks.

Attributes

Experimental
true
Source
Figure.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Transform

How data values become positions along an axis (or steps along a color ramp). The plots hold data in its own units; a transform is applied only when drawing, so the same figure can be shown on a linear or a log axis.

How data values become positions along an axis (or steps along a color ramp). The plots hold data in its own units; a transform is applied only when drawing, so the same figure can be shown on a linear or a log axis.

apply gives NaN for a value with no position of its own: zero or a negative number under Log10. The renderer does not leave such a value out: what is at 0 on a log axis sits on a -∞ line below the lowest number, and a log axis with a negative value is drawn as a symmetric log (Transform.SymLog), which it says under the plot. Only what is not a number at all is left out, and counted.

Attributes

Companion
object
Experimental
true
Source
Transform.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Transform

Attributes

Companion
enum
Experimental
true
Source
Transform.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Transform.type
trait Tweak

A change to how a plot looks, kept as a value. Add it to a plot with +, combine tweaks with +, keep them in a val and use them on every figure of a paper:

A change to how a plot looks, kept as a value. Add it to a plot with +, combine tweaks with +, keep them in a val and use them on every figure of a paper:

val house = Style.slides + Palette.reference + Size(960, 540)
Plot.diagram(d) + house + Labels(title = "Noisy circle") + Scale.xy(Transform.Log10)

Tweaks change independent parts of a figure (its labels, its axes, its colors, its look), so tweaks of different parts can be added in any order; of the same part, the later one wins. A Palette, a Style, Labels, Size, the Scale constructors, Text, Lines and Guide are tweaks.

A tweak that has no meaning for a plot (an axis of a 3-D scene) refuses, saying so; one that merely has nothing to change (a color scale on a figure without one) leaves the plot as it is, so that one bundle fits every plot.

Attributes

Companion
object
Experimental
true
Source
Tweak.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Labels
class Palette
class Size
class Style
class Both
object Tweak

Attributes

Companion
trait
Experimental
true
Source
Tweak.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Tweak.type
object Viewer extends MainRoutes

The live viewer: one browser tab that shows every plot view()ed from this JVM, newest first, as it arrives.

The live viewer: one browser tab that shows every plot view()ed from this JVM, newest first, as it arrives.

The first view() starts a small web server on 127.0.0.1 (port 8337, or a free one when that is taken; set another with the system property tda4j.plot.port or the environment variable TDA4J_PLOT_PORT) and opens the page in the default browser. Where there is no desktop to open it on (a remote machine, a container), it prints the address instead: open it yourself, forwarding the port if needed (ssh -L 8337:localhost:8337 host). Set TDA4J_PLOT_BROWSER=none (or the system property tda4j.plot.browser=none) to never open a browser. The page keeps a list of every plot shown, and reconnects by itself when the JVM restarts on the same port.

Only programs on the same machine can reach 127.0.0.1. Where the page is read from somewhere else and the port cannot be forwarded (a container that publishes the port to its host), name the address to listen on with the system property tda4j.plot.host or the environment variable TDA4J_PLOT_HOST; 0.0.0.0 is every address of the machine. The page has no password: whoever reaches the port sees the plots.

The server's threads are daemon threads: a REPL or script exits as usual, and the page then waits for a new one. Nothing here uses Swing or AWT windows, so it works the same from sbt console, scala and scala-cli on any OS.

Attributes

Experimental
true
Source
Viewer.scala
Supertypes
class MainRoutes
trait Routes
class Main
class Object
trait Matchable
class Any
Show all
Self type
Viewer.type
object Weight

Attributes

Companion
enum
Experimental
true
Source
Elements.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Weight.type
enum Weight(val css: Int)

How heavy a text is, as CSS weights go.

How heavy a text is, as CSS weights go.

Attributes

Companion
object
Experimental
true
Source
Elements.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Window(x0: Double, x1: Double, y0: Double, y1: Double)

The range of a picture a viewer has zoomed to: x0 to x1 along the horizontal axis and y0 to y1 along the vertical one, in data units. PageState.zoom puts it in a still picture. A figure drawn with equal aspect widens one range of the window to keep it, in a still as on the page, so the picture shows a little more than asked for.

The range of a picture a viewer has zoomed to: x0 to x1 along the horizontal axis and y0 to y1 along the vertical one, in data units. PageState.zoom puts it in a still picture. A figure drawn with equal aspect widens one range of the window to keep it, in a still as on the page, so the picture shows a little more than asked for.

Attributes

Experimental
true
Source
Zoom.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum ZoomAxes

Which axes zooming a Panel.Flat.zoomable panel changes: both (the usual), only x (a barcode zoomed along the filtration), or only y.

Which axes zooming a Panel.Flat.zoomable panel changes: both (the usual), only x (a barcode zoomed along the filtration), or only y.

Attributes

Experimental
true
Source
Zoom.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

type XY = (Double, Double)

A point in data coordinates.

A point in data coordinates.

Attributes

Source
Figure.scala
type XYZ = (Double, Double, Double)

A point in 3-D data coordinates.

A point in 3-D data coordinates.

Attributes

Source
Scene.scala