A matplotlib-like plotting library: scatter, histogram, line and bar charts, subplots, as standalone SVG. A Figure holds one or more Axes; drawing the figure builds a PlotScene, an ordered list of pixel-space drawing primitives (lines, polylines, polygons, rects, circles, text), and a backend turns the scene into output. The SVG backend writes SVG 1.1 with no script and no external font, one decimal for every coordinate, so the same data gives the same bytes on every platform. Compile with -lib plot,gen_collect; it needs nothing else and draws without a display. Design: docs/PLOT_DESIGN.md. Examples: docs/AI.md, "Plotting".
Artist
One drawn thing on an Axes: its kind, legend name and data. Axes builds these.
Operations
- New
- GetColNames
- GetColors
- GetCols
- GetDecimals
- GetEdges
- GetKind
- GetName
- GetOutliers
- GetRowNames
- GetRows
- GetSizes
- GetStats
- GetXs
- GetYs
- IsAnnotated
GetColNames #
Column labels of a heatmap.
method : public : GetColNames() ~ String[]Return
| Type | Description |
|---|---|
| String | the labels, or Nil |
GetColors #
Color-scale values.
method : public : GetColors() ~ Float[]Return
| Type | Description |
|---|---|
| Float | one per point, or Nil |
GetCols #
Columns of a heatmap.
method : public : GetCols() ~ IntReturn
| Type | Description |
|---|---|
| Int | the count, 0 for anything else |
GetDecimals #
Decimals of the printed heatmap values.
method : public : GetDecimals() ~ IntReturn
| Type | Description |
|---|---|
| Int | the count |
GetEdges #
Histogram bin edges.
method : public : GetEdges() ~ Float[]Return
| Type | Description |
|---|---|
| Float | the edges, or Nil |
GetKind #
What it draws.
method : public : GetKind() ~ ArtistKindReturn
| Type | Description |
|---|---|
| ArtistKind | the kind |
GetName #
Legend entry.
method : public : GetName() ~ StringReturn
| Type | Description |
|---|---|
| String | the name, possibly empty |
GetOutliers #
Box plot values beyond the whiskers.
method : public : GetOutliers() ~ Float[]Return
| Type | Description |
|---|---|
| Float | the outliers, or Nil |
GetRowNames #
Row labels of a heatmap, top to bottom.
method : public : GetRowNames() ~ String[]Return
| Type | Description |
|---|---|
| String | the labels, or Nil |
GetRows #
Rows of a heatmap.
method : public : GetRows() ~ IntReturn
| Type | Description |
|---|---|
| Int | the count, 0 for anything else |
GetSizes #
Size values.
method : public : GetSizes() ~ Float[]Return
| Type | Description |
|---|---|
| Float | one per point, or Nil |
GetStats #
Box plot statistics.
method : public : GetStats() ~ Float[]Return
| Type | Description |
|---|---|
| Float | [position, low whisker, first quartile, median, third quartile, high whisker], or Nil |
IsAnnotated #
Whether a heatmap prints its values.
method : public : IsAnnotated() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true when annotated |
New # constructor
Constructor for a heatmap.
New(name:String, values:Float[], rows:Int, cols:Int, row_names:String[], col_names:String[], annotate:Bool, decimals:Int)Parameters
| Name | Type | Description |
|---|---|---|
| name | String | legend entry, or empty |
| values | Float | the cells, row by row |
| rows | Int | number of rows |
| cols | Int | number of columns |
| row_names | String | one label per row, top to bottom |
| col_names | String | one label per column |
| annotate | Bool | true to print each value in its cell |
| decimals | Int | decimals in the printed values |
New # constructor
Constructor for a box plot.
New(name:String, values:Float[], stats:Float[], outliers:Float[])Parameters
| Name | Type | Description |
|---|---|---|
| name | String | the category label under the box |
| values | Float | the data |
| stats | Float | [position, low whisker, first quartile, median, third quartile, high whisker] |
| outliers | Float | the values beyond the whiskers, possibly empty |
New # constructor
Constructor
New(kind:ArtistKind, name:String, xs:Float[], ys:Float[], colors:Float[], sizes:Float[], edges:Float[])Parameters
| Name | Type | Description |
|---|---|---|
| kind | ArtistKind | what it draws |
| name | String | legend entry, or empty |
| xs | Float | x values, or category indexes, or bar centers |
| ys | Float | y values or bar heights |
| colors | Float | values mapped to the color scale (scatter), or Nil |
| sizes | Float | values mapped to marker area (scatter), or Nil |
| edges | Float | histogram bin edges, or Nil |