nspl-core-js

Packages

package org.nspl

nspl is a Scala library to describe and render scientific plots.

nspl is a Scala library to describe and render scientific plots.

Entry points into the API:

  • org.nspl.xyplot is the most important method to define a plot in Cartesian coordinate systems,
  • org.nspl.data.DataSource. All data must be supplied as a DataSource. Its main abstraction is an iterator over rows (org.nspl.data.Row) where a row is an indexed sequence of doubles. Each row has the same length in a DataSource. A DataSource may be lazy (e.g. load data from disk on demand).
  • org.nspl.par.apply describe settings governing most plots (axis labels, plot titles, ticks, etc),
  • org.nspl.awtrenderer for methods to render the plot with Java AWT into PNG, JPG, PDF or a Java Graphics2D context,
  • org.nspl.canvasrenderer for methods to render the plot with Html5 Canvas in the browser.

Premade plot factories for various types of plots:

Data renderers:

Data sources:

  • org.nspl.data.DataTable Generic tabular data source on a row major double array
  • There exist implicit conversion methods to provide DataSource views on tuples of Doubles or other types from the standard library. Most of these are not copying. They are imported with import org.nspl._ import.
  • org.nspl.data.DataMatrix Data is viewed as a bitmap/raster: first dimension is x, second is y coordinates, third is color value
  • org.nspl.saddle provides interface from Saddle types.

The more general scene graph and layout functionality of the library is exposed via:

Rendering contexts:

  • org.nspl.canvasrenderer for Html5 Canvas. This context is interactive with support for panning and zooming. See org.nspl.canvasrenderer.render
  • org.nspl.awtrenderer for various format on the JVM. e.g see methods like org.nspl.awtrenderer.pdfToFile
  • org.nspl.scalatagrenderer for SVG plots (Scala.js and JVM). See org.nspl.scalatagrenderer.renderToScalaTag