ApasScript.

Plotting

graph

Creates a new plotting canvas: graph() for defaults, graph(w, h) for a size in pixels with the range fitted to what is plotted, graph(xmin, xmax, ymin, ymax) sized automatically from the data range, or graph(w, h, xmin, xmax, ymin, ymax) with explicit pixel dimensions.

title

Sets a graph's title.

xticks

Sets a graph's x-axis tick spacing.

yticks

Sets a graph's y-axis tick spacing.

plot

Adds a line series to a graph: plot(g, ys) auto-indexes x = 1..n, plot(g, xs, ys) uses an explicit x array, or plot(g, "expr", min, max) samples an expression in x over a range. Optional trailing color/linetype/label style args.

axes

Shows or hides a graph's axes.

grid

Shows or hides a graph's grid lines.

aspect

Forces a graph's x and y axes to use equal pixels-per-unit scaling, so geometric shapes aren't visually distorted.

tracePlot Apas Cloud

Makes the curves of a graph draw themselves in: each line traces from the start of its range to the end (x for plot, t for plotParametric, theta for plotPolar) over the given number of seconds, with a dot at the moving end. Leave the seconds out for 4; at most 60; 0 turns it off. On a page the reader can click the picture to play it again. SVG, PNG and PDF output show the finished curves. One-line form: tracePlot(g, "expr", min, max, seconds, color, linetype, label) plots the function and traces it in one call; tracePolar and traceParametric do the same for the other two kinds of curve. All curves of one graph draw together, over the time given last.

tracePolar Apas Cloud

plotPolar and tracePlot in one line: adds the polar curve r(theta) to the graph and makes the graph's curves draw themselves in over the given number of seconds (4 if left out, at most 60). The optional color, line type and label follow the seconds, as in plotPolar.

traceParametric Apas Cloud

plotParametric and tracePlot in one line: adds the curve (x(t), y(t)) to the graph and makes the graph's curves draw themselves in over the given number of seconds (4 if left out, at most 60). The optional color, line type and label follow the seconds, as in plotParametric.

plotParametric

Adds a parametric curve series (x(t), y(t)) to a graph, sampled over an explicit t range.

plotPolar

Adds a polar curve series r(theta) to a graph, sampled over an explicit theta range.

scatter

Adds a scatter (points only, no line) series to a graph: scatter(g, ys) auto-indexes x, scatter(g, xs, ys) uses an explicit x array.

bar

Adds a bar series to a graph: bar(g, ys) auto-indexes x, bar(g, xs, ys) uses an explicit x array. When xs is a list of names, bar(g, ["Mon", "Tue"], ys), each bar is named on the x axis and drawn as a thin bar with a rounded end. Several bar series on one graph are told apart by colour and label; stacked(g) stands them on one another.

stacked

Stands the bar series of a graph on one another instead of one in front of the other: at each x the first series is at the bottom and each later one starts where the one before it ends. Values above zero stack upwards and values below zero downwards. stacked(g, false) turns it off again.

pie

Draws values as parts of a whole: pie(g, names, values) gives one slice for each value, starting at twelve o'clock and going clockwise, with each name, value and share listed beside it. A fourth argument between 0 and 1 leaves a hole of that part of the radius, which makes a ring. A list of colours, one for each slice, may be given last. The values must be zero or more, with at least one above zero.

area

Adds a filled-area line series (filled to y=0) to a graph.

bubble

Adds a bubble series to a graph -- a scatter plot where a third array sets each point's marker size.

histogram

Bins raw data into equal-width buckets and adds it to a graph as a bar series.

candlestick

Adds a candlestick (OHLC) series to a graph, typically indexed by date().

logScale

Switches a graph's x, y, or both axes to a logarithmic scale.