docstr: Return list of gridline coordinates in data coordinates.
  
  Parameters
  ----------
  which : {"both", "major", "minor"}
  axis : {"both", "x", "y"}
docstr_tok: ["Return","list","of","gridline","coordinates","in","data","coordinates",".","Parameters","--","--","--","--","--","which",":","{","``","both","''",",","``","major","''",",","``","minor","''","}","axis",":","{","``","both","''",",","``","x","''",",","``","y","''","}"]
code: def get_gridlines(self, which="major", axis="both"):
      """
      Return list of gridline coordinates in data coordinates.
  
      Parameters
      ----------
      which : {"both", "major", "minor"}
      axis : {"both", "x", "y"}
      """
      _api.check_in_list(["both", "major", "minor"], which=which)
      _api.check_in_list(["both", "x", "y"], axis=axis)
      gridlines = []
  
      if axis in ("both", "x"):
          locs = []
          y1, y2 = self.axes.get_ylim()
          if which in ("both", "major"):
              locs.extend(self.axes.xaxis.major.locator())
          if which in ("both", "minor"):
              locs.extend(self.axes.xaxis.minor.locator())
          gridlines.extend([[x, x], [y1, y2]] for x in locs)
  
      if axis in ("both", "y"):
          x1, x2 = self.axes.get_xlim()
          locs = []
          if self.axes.yaxis._major_tick_kw["gridOn"]:
              locs.extend(self.axes.yaxis.major.locator())
          if self.axes.yaxis._minor_tick_kw["gridOn"]:
              locs.extend(self.axes.yaxis.minor.locator())
          gridlines.extend([[x1, x2], [y, y]] for y in locs)
  
      return gridlines
  
imports: import numpy
  import matplotlib
  from matplotlib import _api
  import matplotlib.axes
  from matplotlib.path import Path
  from mpl_toolkits.axes_grid1 import mpl_axes
  from .axisline_style import AxislineStyle
  from .axis_artist import AxisArtist, GridlinesCollection
label_desc: Use image node_id 4 for calling the GridHelperRectlinear obj's underlying member method code with example usage: obj.get_gridlines(which, axis) and returns: gridlines