MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / grid

Method grid

lib/matplotlib/axis.py:1844–1884  ·  view source on GitHub ↗

Configure the grid lines. Parameters ---------- visible : bool or None Whether to show the grid lines. If any *kwargs* are supplied, it is assumed you want the grid on and *visible* will be set to True. If *visible* is *None* an

(self, visible=None, which='major', **kwargs)

Source from the content-addressed store, hash-verified

1842 return self.minorTicks[:numticks]
1843
1844 def grid(self, visible=None, which='major', **kwargs):
1845 """
1846 Configure the grid lines.
1847
1848 Parameters
1849 ----------
1850 visible : bool or None
1851 Whether to show the grid lines. If any *kwargs* are supplied, it
1852 is assumed you want the grid on and *visible* will be set to True.
1853
1854 If *visible* is *None* and there are no *kwargs*, this toggles the
1855 visibility of the lines.
1856
1857 which : {'major', 'minor', 'both'}
1858 The grid lines to apply the changes on.
1859
1860 **kwargs : `~matplotlib.lines.Line2D` properties
1861 Define the line properties of the grid, e.g.::
1862
1863 grid(color='r', linestyle='-', linewidth=2)
1864 """
1865 if kwargs:
1866 if visible is None:
1867 visible = True
1868 elif not visible: # something false-like but not None
1869 _api.warn_external('First parameter to grid() is false, '
1870 'but line properties are supplied. The '
1871 'grid will be enabled.')
1872 visible = True
1873 which = which.lower()
1874 _api.check_in_list(['major', 'minor', 'both'], which=which)
1875 gridkw = {f'grid_{name}': value for name, value in kwargs.items()}
1876 if which in ['minor', 'both']:
1877 gridkw['gridOn'] = (not self._minor_tick_kw['gridOn']
1878 if visible is None else visible)
1879 self.set_tick_params(which='minor', **gridkw)
1880 if which in ['major', 'both']:
1881 gridkw['gridOn'] = (not self._major_tick_kw['gridOn']
1882 if visible is None else visible)
1883 self.set_tick_params(which='major', **gridkw)
1884 self.stale = True
1885
1886 def update_units(self, data):
1887 """

Callers 15

make_matplotlib_iconFunction · 0.45
colorbarMethod · 0.45
gridFunction · 0.45
key_press_handlerFunction · 0.45
quick_start.pyFile · 0.45
axes_ticks.pyFile · 0.45
axes_scales.pyFile · 0.45
psd_demo.pyFile · 0.45
boxplot_demo.pyFile · 0.45
csd_demo.pyFile · 0.45

Calls 1

set_tick_paramsMethod · 0.95

Tested by

no test coverage detected