docstr: Toggle the gridlines, and optionally set the properties of the lines.
docstr_tok: ["Toggle","the","gridlines",",","and","optionally","set","the","properties","of","the","lines","."]
code: def grid(self, visible=None, which="major", axis="both", **kwargs):
      """
      Toggle the gridlines, and optionally set the properties of the lines.
      """
      # There are some discrepancies in the behavior of grid() between
      # axes_grid and Matplotlib, because axes_grid explicitly sets the
      # visibility of the gridlines.
      super().grid(visible, which=which, axis=axis, **kwargs)
      if not self._axisline_on:
          return
      if visible is None:
          visible = (
              self.axes.xaxis._minor_tick_kw["gridOn"]
              or self.axes.xaxis._major_tick_kw["gridOn"]
              or self.axes.yaxis._minor_tick_kw["gridOn"]
              or self.axes.yaxis._major_tick_kw["gridOn"]
          )
      self.gridlines.set(which=which, axis=axis, visible=visible)
      self.gridlines.set(**kwargs)
  
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 7 for calling the Axes obj's underlying member method code with example usage: obj.grid(visible, which, axis) without return types