Qu

donut

Builtin index · Plotting

donut(values, [label1, label2, ...])

Input: values, label1, label2, ... · Output: no output

What it is

Pie chart with a hollow center. values is a Vec of numbers (slice magnitudes); trailing string arguments (variadic, optional) label the slices in order.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
donut(values, [label1, label2, ...])
values Vec or numbervalues is a Vec of numbers (slice magnitudes).
label1, label2, ... optional, repeatablenot documented yet
no outputPie chart with a hollow center.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

x = 0 to 9
y = sin(x / 2)
figure()
errorbar(x, y, 0.1 * ones(10))
figure()
fill_between(x, y - 0.2, y + 0.2)
figure()
bubble(x, y, abs(y) * 20 + 5)
figure()
donut([30, 20, 50], "a", "b", "c")
figure()
pie([30, 20, 50], "a", "b", "c")
a (30%) b (20%) c (50%)

from plotting

How it works

pie(values, [labels...]) / donut(values, [labels...]) — labels are optional trailing string arguments, one per value.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.