grid
grid([xmin=0], [xmax=width of canvas], [ymin=0], [ymax=height of canvas], [stepminor=10], [colorminor=#CFD8DC], [weightminor=1], [stepmajor=100], [colormajor=#90A4AE], [weightmajor=1])
Draw a grid - from top/left to bottom/right by default, from center if canvas is centered
Syntaxe
grid()
grid(xmin=0, xmax=500, ymin=0, ymax=500, stepMinor=10, colorMinor="#FFE0B2", weightMinor=1, stepMajor=100, colorMajor="#FFB74D", weightMajor=1);
Arguments
| Name | Required | Default | Description |
|---|---|---|---|
xmin | - | 0 | left position of the grid |
xmax | - | width of canvas | right position of the grid |
ymin | - | 0 | top position of the grid |
ymax | - | height of canvas | bottom position of the grid |
stepminor | - | 10 | minor graduation |
colorminor | - | #CFD8DC | minor color |
weightminor | - | 1 | minor graduation weight |
stepmajor | - | 100 | major graduation |
colormajor | - | #90A4AE | minor color |
weightmajor | - | 1 | majoe graduation weight |
Full example
canvas(width=666, height=600, center=true);
grid();
circle(0,0,10, stroke="#F00");
coord_rotate(0.1);
grid(xmin=0, xmax=500, ymin=0, ymax=500, stepMinor=10, colorMinor="#FFE0B2", weightMinor=1.5, stepMajor=100, colorMajor="#FFB74D", weightMajor=3);
save("grid.png");
