Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
import math
from typing import List
from .charts_axis_axis_from_ticks import axis_line, check_orient ← axisFromTicks, another function of this group · built into the same file, even by a slim install
from .charts_axis_types import Axis, Line
def grid_lines(axis: Axis, length: float) -> List[Line]:
"""One gridline per tick, from the axis line across the plot."""
check_orient(axis.orient)
if isinstance(length, bool) or not isinstance(length, (int, float)) or not math.isfinite(length) or length < 0:
raise ValueError("length must be a finite number of zero or more, received %r" % (length,))
pos = axis.position
out = []
for t in axis.ticks:
p = t.position
if axis.orient == "bottom":
out.append(axis_line(p, pos, p, pos - length))
elif axis.orient == "top":
out.append(axis_line(p, pos, p, pos + length))
elif axis.orient == "left":
out.append(axis_line(pos, p, pos + length, p))
else:
out.append(axis_line(pos, p, pos - length, p))
return out