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

Method __init__

lib/matplotlib/gridspec.py:33–56  ·  view source on GitHub ↗

Parameters ---------- nrows, ncols : int The number of rows and columns of the grid. width_ratios : array-like of length *ncols*, optional Defines the relative widths of the columns. Each column gets a relative width of ``width_rat

(self, nrows, ncols, height_ratios=None, width_ratios=None)

Source from the content-addressed store, hash-verified

31 """
32
33 def __init__(self, nrows, ncols, height_ratios=None, width_ratios=None):
34 """
35 Parameters
36 ----------
37 nrows, ncols : int
38 The number of rows and columns of the grid.
39 width_ratios : array-like of length *ncols*, optional
40 Defines the relative widths of the columns. Each column gets a
41 relative width of ``width_ratios[i] / sum(width_ratios)``.
42 If not given, all columns will have the same width.
43 height_ratios : array-like of length *nrows*, optional
44 Defines the relative heights of the rows. Each row gets a
45 relative height of ``height_ratios[i] / sum(height_ratios)``.
46 If not given, all rows will have the same height.
47 """
48 if not isinstance(nrows, Integral) or nrows <= 0:
49 raise ValueError(
50 f"Number of rows must be a positive integer, not {nrows!r}")
51 if not isinstance(ncols, Integral) or ncols <= 0:
52 raise ValueError(
53 f"Number of columns must be a positive integer, not {ncols!r}")
54 self._nrows, self._ncols = nrows, ncols
55 self.set_height_ratios(height_ratios)
56 self.set_width_ratios(width_ratios)
57
58 def __repr__(self):
59 height_arg = (f', height_ratios={self._row_height_ratios!r}'

Callers

nothing calls this directly

Calls 2

set_height_ratiosMethod · 0.95
set_width_ratiosMethod · 0.95

Tested by

no test coverage detected