class_docstr: Stepped connected points
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  direction : Literal["hv", "vh", "mid"], default="hv"
      horizontal-vertical steps,
      vertical-horizontal steps or steps half-way between adjacent
      x values.
  
  See Also
  --------
  plotnine.geoms.geom_path : For documentation of extra parameters.
class_docstr_tok: ["Stepped","connected","points","{","usage","}","Parameters","--","--","--","--","--","{","common_parameters","}","direction",":","Literal","[","``","hv","''",",","``","vh","''",",","``","mid","''","]",",","default=","''","hv","''","horizontal-vertical","steps",",","vertical-horizontal","steps","or","steps","half-way","between","adjacent","x","values",".","See","Also","--","--","--","--","plotnine.geoms.geom_path",":","For","documentation","of","extra","parameters","."]
code: def draw_group(
      data: pd.DataFrame,
      panel_params: panel_view,
      coord: Coord,
      ax: Axes,
      **params: Any,
  ):
      direction = params["direction"]
      n = len(data)
      data = data.sort_values("x", kind="mergesort")
      x = data["x"].to_numpy()
      y = data["y"].to_numpy()
  
      if direction == "vh":
          # create stepped path -- interleave x with
          # itself and y with itself
          xidx = np.repeat(range(n), 2)[:-1]
          yidx = np.repeat(range(n), 2)[1:]
          new_x, new_y = x[xidx], y[yidx]
      elif direction == "hv":
          xidx = np.repeat(range(n), 2)[1:]
          yidx = np.repeat(range(n), 2)[:-1]
          new_x, new_y = x[xidx], y[yidx]
      elif direction == "mid":
          xidx = np.repeat(range(n - 1), 2)
          yidx = np.repeat(range(n), 2)
          diff = x[1::] - x[:-1:]
          mid_x = x[:-1:] + diff / 2
          new_x = np.hstack([x[0], mid_x[xidx], x[-1]])
          new_y = y[yidx]
      else:
          raise PlotnineError(f"Invalid direction `{direction}`")
  
      path_data = pd.DataFrame({"x": new_x, "y": new_y})
      copy_missing_columns(path_data, data)
      geom_path.draw_group(path_data, panel_params, coord, ax, **params)
  
file_path: plotnine/plotnine/geoms/geom_step.py
imports: from __future__ import annotations
  import typing
  import numpy
  import pandas
  from .._utils import copy_missing_columns
  from ..doctools import document
  from ..exceptions import PlotnineError
  from .geom import geom
  from .geom_path import geom_path
label_desc: Use image node_id 1 for calling the geom_step obj's underlying member method code with example usage: obj.draw_group(data, panel_params, coord, ax) without return types