Plotting Data (2D)
The plot
module is used to create two-dimensional plots from structured input
data, such as CSV or GeoJSON files. To use the plot module, add the following line
to an empty file:
class: plot;
The remainder of the file should then contain a list of statements. Statements are
generally divided into two categories. Geometry statements, such as lines
, points
or bars
add shapes to the plot, while layout statements, such as axis
, grid
or
legend
control the appearance of the chart layout.
List of statements
This section lists all available options for the plot
module. Please follow the
respective links in the text below for more details on individual commands.
/* Geometry Statements */
areas {...}
bars {...}
errorbars {...}
labels {...}
lines {...}
points {...}
polygons {...}
rectangles {...}
vectors {...}
/* Axis Statements */
axes {...}
axis {...}
/* Grid & Legend Statements */
grid {...}
legend {...}
/* Margin Options */
margin: ...;
margin-top: ...;
margin-left: ...;
margin-right: ...;
margin-bottom: ...;
Example
Here is a full example that will generate a simple line chart:
class: plot;
lines {
data-x: list(100 300 500 700 900);
data-y: list(200 300 200 300 100);
color: #06c;
stroke-width: 2pt;
}
Reference
This section contains reference specifications and descriptions for concepts that are shared among all statements.