code: def _init_subplot_xy(
      layout, secondary_y, x_domain, y_domain, max_subplot_ids=None
  ):
      if max_subplot_ids is None:
          max_subplot_ids = _get_initial_max_subplot_ids()
  
      # Get axis label and anchor
      x_cnt = max_subplot_ids["xaxis"] + 1
      y_cnt = max_subplot_ids["yaxis"] + 1
  
      # Compute x/y labels (the values of trace.xaxis/trace.yaxis
      x_label = "x{cnt}".format(cnt=x_cnt if x_cnt > 1 else "")
      y_label = "y{cnt}".format(cnt=y_cnt if y_cnt > 1 else "")
  
      # Anchor x and y axes to each other
      x_anchor, y_anchor = y_label, x_label
  
      # Build layout.xaxis/layout.yaxis containers
      xaxis_name = "xaxis{cnt}".format(cnt=x_cnt if x_cnt > 1 else "")
      yaxis_name = "yaxis{cnt}".format(cnt=y_cnt if y_cnt > 1 else "")
      x_axis = {"domain": x_domain, "anchor": x_anchor}
      y_axis = {"domain": y_domain, "anchor": y_anchor}
  
      layout[xaxis_name] = x_axis
      layout[yaxis_name] = y_axis
  
      subplot_refs = [
          SubplotRef(
              subplot_type="xy",
              layout_keys=(xaxis_name, yaxis_name),
              trace_kwargs={"xaxis": x_label, "yaxis": y_label},
          )
      ]
  
      if secondary_y:
          y_cnt += 1
          secondary_yaxis_name = "yaxis{cnt}".format(
              cnt=y_cnt if y_cnt > 1 else ""
          )
          secondary_y_label = "y{cnt}".format(cnt=y_cnt)
  
          # Add secondary y-axis to subplot reference
          subplot_refs.append(
              SubplotRef(
                  subplot_type="xy",
                  layout_keys=(xaxis_name, secondary_yaxis_name),
                  trace_kwargs={
                      "xaxis": x_label,
                      "yaxis": secondary_y_label,
                  },
              )
          )
  
          # Add secondary y axis to layout
          secondary_y_axis = {
              "anchor": y_anchor,
              "overlaying": y_label,
              "side": "right",
          }
          layout[secondary_yaxis_name] = secondary_y_axis
  
      # increment max_subplot_ids
      max_subplot_ids["xaxis"] = x_cnt
      max_subplot_ids["yaxis"] = y_cnt
  
      return tuple(subplot_refs)
  
file_path: catboost/contrib/python/plotly/py2/plotly/subplots.py
imports: from __future__ import absolute_import, unicode_literals
  import collections
label_desc: Use image node_id 4 for calling a global function with example usage: _init_subplot_xy(layout, secondary_y, x_domain, y_domain, max_subplot_ids) and returns: tuple