PLAYGROUND (experimental)

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

NameRequiredDefaultDescription
xmin-0left position of the grid
xmax-width of canvasright position of the grid
ymin-0top position of the grid
ymax-height of canvasbottom position of the grid
stepminor-10minor graduation
colorminor-#CFD8DCminor color
weightminor-1minor graduation weight
stepmajor-100major graduation
colormajor-#90A4AEminor color
weightmajor-1majoe 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");