code: def add_ticks(da, locations, direction):
      from matplotlib.collections import LineCollection
  
      segments = []
      if direction == "vertical":
          x1, x2, x3, x4 = np.array([0.0, 1 / 5, 4 / 5, 1.0]) * da.width
          for y in locations:
              segments.extend(
                  [
                      ((x1, y), (x2, y)),
                      ((x3, y), (x4, y)),
                  ]
              )
      else:
          y1, y2, y3, y4 = (
              np.array([0.0, 1 / 5, 4 / 5, 1.0]) * da.height
          )
          for x in locations:
              segments.extend(
                  [
                      ((x, y1), (x, y2)),
                      ((x, y3), (x, y4)),
                  ]
              )
  
      coll = LineCollection(
          segments, color="#CCCCCC", linewidth=1, antialiased=False
      )
      da.add_artist(coll)
  
imports: from __future__ import annotations
  import hashlib
  import typing
  from warnings import warn
  import numpy
  import pandas
  from mizani.bounds import rescale
  from ..exceptions import PlotnineWarning
  from ..mapping.aes import rename_aesthetics
  from ..scales.scale_continuous import scale_continuous
  from .guide import guide
label_desc: Use image node_id 3 for calling a global function with example usage: add_ticks(da, locations, direction) without return types