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)
| 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 | """ |
no test coverage detected