MCPcopy
hub / github.com/matplotlib/matplotlib / subplot_mosaic

Method subplot_mosaic

lib/matplotlib/figure.py:1906–2213  ·  view source on GitHub ↗

Build a layout of Axes based on ASCII art or nested lists. This is a helper function to build complex GridSpec layouts visually. See :ref:`mosaic` for an example and full API documentation Parameters ---------- mosaic : list of list of {has

(self, mosaic, *, sharex=False, sharey=False,
                       width_ratios=None, height_ratios=None,
                       empty_sentinel='.',
                       subplot_kw=None, per_subplot_kw=None, gridspec_kw=None)

Source from the content-addressed store, hash-verified

1904 return [list(ln) for ln in layout.strip('\n').split('\n')]
1905
1906 def subplot_mosaic(self, mosaic, *, sharex=False, sharey=False,
1907 width_ratios=None, height_ratios=None,
1908 empty_sentinel='.',
1909 subplot_kw=None, per_subplot_kw=None, gridspec_kw=None):
1910 """
1911 Build a layout of Axes based on ASCII art or nested lists.
1912
1913 This is a helper function to build complex GridSpec layouts visually.
1914
1915 See :ref:`mosaic`
1916 for an example and full API documentation
1917
1918 Parameters
1919 ----------
1920 mosaic : list of list of {hashable or nested} or str
1921
1922 A visual layout of how you want your Axes to be arranged
1923 labeled as strings. For example ::
1924
1925 x = [['A panel', 'A panel', 'edge'],
1926 ['C panel', '.', 'edge']]
1927
1928 produces 4 Axes:
1929
1930 - 'A panel' which is 1 row high and spans the first two columns
1931 - 'edge' which is 2 rows high and is on the right edge
1932 - 'C panel' which in 1 row and 1 column wide in the bottom left
1933 - a blank space 1 row and 1 column wide in the bottom center
1934
1935 Any of the entries in the layout can be a list of lists
1936 of the same form to create nested layouts.
1937
1938 If input is a str, then it can either be a multi-line string of
1939 the form ::
1940
1941 '''
1942 AAE
1943 C.E
1944 '''
1945
1946 where each character is a column and each line is a row. Or it
1947 can be a single-line string where rows are separated by ``;``::
1948
1949 'AB;CC'
1950
1951 The string notation allows only single character Axes labels and
1952 does not support nesting but is very terse.
1953
1954 The Axes identifiers may be `str` or a non-iterable hashable
1955 object (e.g. `tuple` s may not be used).
1956
1957 sharex, sharey : bool, default: False
1958 If True, the x-axis (*sharex*) or y-axis (*sharey*) will be shared
1959 among all subplots. In that case, tick label visibility and axis
1960 units behave as for `subplots`. If False, each subplot's x- or
1961 y-axis will be independent.
1962
1963 width_ratios : array-like of length *ncols*, optional

Callers 15

subplot_mosaicFunction · 0.80
test_submerged_width_gapFunction · 0.80
test_basicMethod · 0.80
test_all_nestedMethod · 0.80
test_nestedMethod · 0.80
test_nested_tupleMethod · 0.80
test_emptyMethod · 0.80

Calls 8

_norm_per_subplot_kwMethod · 0.95
add_gridspecMethod · 0.95
valuesMethod · 0.80
sharexMethod · 0.80
_label_outer_xaxisMethod · 0.80
shareyMethod · 0.80
_label_outer_yaxisMethod · 0.80

Tested by 15

test_submerged_width_gapFunction · 0.64
test_basicMethod · 0.64
test_all_nestedMethod · 0.64
test_nestedMethod · 0.64
test_nested_tupleMethod · 0.64
test_emptyMethod · 0.64
test_fail_list_of_strMethod · 0.64