class_docstr: Stack plotted objects on top of each other
  
  The objects to stack are those that have
  an overlapping x range.
  
  Parameters
  ----------
  vjust :
      By what fraction to avoid overlapping the lower object,
      where `0` gives a complete overlap and `1` gives no overlap.
  reverse :
      Reverse the order of the stacked groups if true.
docstr: Stack overlapping intervals.
  
  Assumes that each set has the same horizontal position
docstr_tok: ["Stack","overlapping","intervals",".","Assumes","that","each","set","has","the","same","horizontal","position"]
code: def strategy(data, params):
      """
      Stack overlapping intervals.
  
      Assumes that each set has the same horizontal position
      """
      vjust = params["vjust"]
  
      y = data["y"].copy()
      y[np.isnan(y)] = 0
      heights = np.append(0, y.cumsum())
  
      if params["fill"]:
          heights = heights / np.abs(heights[-1])
  
      data["ymin"] = np.min([heights[:-1], heights[1:]], axis=0)
      data["ymax"] = np.max([heights[:-1], heights[1:]], axis=0)
      # less intuitive than (ymin + vjust(ymax-ymin)), but
      # this way avoids subtracting numbers of potentially
      # similar precision
      data["y"] = (1 - vjust) * data["ymin"] + vjust * data["ymax"]
      return data
  
file_path: plotnine/plotnine/positions/position_stack.py
imports: from __future__ import annotations
  from warnings import warn
  import numpy
  import pandas
  from .._utils import remove_missing
  from ..exceptions import PlotnineWarning
  from .position import position
label_desc: Use image node_id 5 for calling the position_stack obj's underlying member method code with example usage: obj.strategy(data, params) and returns: data