breeze.plot

package breeze.plot

Basic 2-d plotting package. This API is very experimentable, I reserve the right to change everything.

Type members

Classlikes

case class CategoricalPaintScale[T](categories: T => Paint) extends PaintScale[T]

Maps items to colors using the given partial function. If no color is provided for the given item, then returns PaintScale.nanPaint.

Maps items to colors using the given partial function. If no color is provided for the given item, then returns PaintScale.nanPaint.

Creates a categorical paint scale using the Category20 palette borrowed from Protovis. http://vis.stanford.edu/protovis/docs/color.html

Creates a categorical paint scale using the Category20 palette borrowed from Protovis. http://vis.stanford.edu/protovis/docs/color.html

Beware that category colors can be reused if the number of distinct items is greater than 20.

trait DomainFunction[T, K, +V]

Represents a "function" T that knows its (finite) domain, and can also be applied. Typeclass.

Represents a "function" T that knows its (finite) domain, and can also be applied. Typeclass.

Companion:
object
Companion:
class
case class DynamicHistogramBins(number: Int) extends HistogramBins

Create a set of StaticHistogramBins from a number and an (eventual) lower and upper bound.

Create a set of StaticHistogramBins from a number and an (eventual) lower and upper bound.

Utility functions for exporting a Graphics2D drawable to some eps, pdf, and png.

Utility functions for exporting a Graphics2D drawable to some eps, pdf, and png.

class Figure(name: String, var rows_: Int, var cols_: Int)
Companion:
object
object Figure
Companion:
class
case class GradientPaintScale[T](lower: T, upper: T, gradient: Array[Color])(implicit view: Conversion[T, Double]) extends PaintScale[T]

A simple numeric paint scale for mapping a number within a range to a corresponding element of a pre-computed color gradient. Colors from the given gradient array are used linearly to represent values between lower and upper.

A simple numeric paint scale for mapping a number within a range to a corresponding element of a pre-computed color gradient. Colors from the given gradient array are used linearly to represent values between lower and upper.

case class GradientPaintScaleFactory[T](gradient: Array[Color])(implicit view: ConversionOrSubtype[T, Double]) extends PaintScaleFactory[T]

Creates a GradientPaintScale from the min and max of a set of data points. bound are supplied.

Creates a GradientPaintScale from the min and max of a set of data points. bound are supplied.

sealed trait HistogramBins

Bins for a histogram. These can be implicitly constructed from:

Bins for a histogram. These can be implicitly constructed from:

 x : HistogramBins = 10  // 10 dynamically determined histogram bins
 x : HistogramBins = Array(1.0,2.0,3.2) // five buckets wit the given splits
 x : HistogramBins = (0,100,10) // ten bins evenly dividing 0 to 100.
Companion:
object

Static constructors for HistogramBins.

Static constructors for HistogramBins.

Companion:
class
sealed trait PaintScale[T] extends T => Paint

Maps items of type T to a well defined Paint (usually a color).

Maps items of type T to a well defined Paint (usually a color).

An implicit conversion exists to make a singleton PaintScaleFactory from a PaintScale instance, which means that PaintScales can be provided directly whenever a PaintScaleFactory is required.

Companion:
object
object PaintScale
Companion:
class
trait PaintScaleFactory[T] extends Iterable[T] => PaintScale[T]

Constructs a PaintScale for the given type T by examining a set of its values.

Constructs a PaintScale for the given type T by examining a set of its values.

Companion:
object
Companion:
class
class Plot()

Maintains a set of series (or more strictly, the data from those series) and the necessary JFreeChart stuff to plot them.

Maintains a set of series (or more strictly, the data from those series) and the necessary JFreeChart stuff to plot them.

Companion:
object
object Plot
Companion:
class
trait Series

A Series is anything that can be added to a breeze.plot.Plot and plotted

A Series is anything that can be added to a breeze.plot.Plot and plotted

case class StaticHistogramBins(splits: Array[Double]) extends HistogramBins

Set of histograms for binning data using the given splits.

Set of histograms for binning data using the given splits.

class XYDataset[Item](x: Item => Number, y: Item => Number, label: Item => String, tip: Item => String) extends AbstractXYDataset

An XY dataset consisting of some number of named series, each consisting of items of type Item, with an associated x value, y value, and optionally a name and tooltip.

An XY dataset consisting of some number of named series, each consisting of items of type Item, with an associated x value, y value, and optionally a name and tooltip.

Companion:
object
object XYDataset
Companion:
class
class XYZDataset[Item](x: Item => Number, y: Item => Number, z: Item => Number, label: Item => String, tip: Item => String) extends AbstractXYZDataset

An XYX dataset consisting of some number of named series, each consisting of items of type Item, with an associated x value, y value, z value, and optionally a name and tooltip.

An XYX dataset consisting of some number of named series, each consisting of items of type Item, with an associated x value, y value, z value, and optionally a name and tooltip.

Companion:
object
object XYZDataset
Companion:
class

Value members

Concrete methods

def hist[D, K, V](data: D, bins: HistogramBins, name: String)(implicit xv: DomainFunction[D, Int, V], vv: V => Double): Series

Plots a histogram of the given data into the given number of bins

Plots a histogram of the given data into the given number of bins

def image[M, V](img: Matrix[Double], scale: GradientPaintScale[Double], name: String, offset: (Int, Int), labels: PartialFunction[(Int, Int), String], tips: PartialFunction[(Int, Int), String]): Series

Displays an image in the current figure, where each cell in the matrix provides color for one square of the image.

Displays an image in the current figure, where each cell in the matrix provides color for one square of the image.

Value parameters:
img

A matrix containing the colors to plot

labels

Labels for some subset of the data points

name

Series name

offset

Offset for indexing the top-left corner of the matrix

scale

Scale used for converting matrix values to colors.

tips

Tooltip popups for some subset of the data points

def plot[X, Y, V](x: X, y: Y, style: Char, colorcode: String, name: String, lines: Boolean, shapes: Boolean, labels: Int => String, tips: Int => String)(implicit xv: DomainFunction[X, Int, V], yv: DomainFunction[Y, Int, V], vv: V => Double): Series

Plots the given y versus the given x with the given style.

Plots the given y versus the given x with the given style.

Value parameters:
labels

Optional in-graph labels for some points.

name

Name of the series to show in the legend.

style

Matlab-like style spec of the series to plot.

tips

Optional mouse-over tooltips for some points.

x

X-coordinates, co-indexed with y (and indexed by keys of type K).

y

Y-coordinates, co-indexed with x (and indexed by keys of type K).

def scatter[X, V, Y, YV](x: X, y: Y, size: Int => Double, colors: Int => Paint, labels: Int => String, tips: Int => String, name: String)(implicit xv: DomainFunction[X, Int, V], yv: DomainFunction[Y, Int, V], vv: V => Double): Series

Displays a scatter plot of x versus y, each point drawn at the given size and mapped with the given color.

Displays a scatter plot of x versus y, each point drawn at the given size and mapped with the given color.

Example usage: https://gist.github.com/1288473

Value parameters:
c

A partial function (e.g. a Map) from item ids to the color to draw the bubble. Missing colors are drawn with a hashed pattern.

labels

Labels to draw next to each point.

name

Series name for legend

size

The size of each circle (on the same scale as the domain axis)

tips

Tooltips to show on mouseover for each point.

x

The x coordinates to draw as provided by anything that can be seen as a Tensor1.

y

The y coordinates to draw as provided by anything that can be seen as a Tensor1.