Add a set of subplots to this figure. This utility wrapper makes it convenient to create common layouts of subplots in a single call. Parameters ---------- nrows, ncols : int, default: 1 Number of rows/columns of the subplot grid.
(self, nrows=1, ncols=1, *, sharex=False, sharey=False,
squeeze=True, width_ratios=None, height_ratios=None,
subplot_kw=None, gridspec_kw=None)
| 790 | return ax |
| 791 | |
| 792 | def subplots(self, nrows=1, ncols=1, *, sharex=False, sharey=False, |
| 793 | squeeze=True, width_ratios=None, height_ratios=None, |
| 794 | subplot_kw=None, gridspec_kw=None): |
| 795 | """ |
| 796 | Add a set of subplots to this figure. |
| 797 | |
| 798 | This utility wrapper makes it convenient to create common layouts of |
| 799 | subplots in a single call. |
| 800 | |
| 801 | Parameters |
| 802 | ---------- |
| 803 | nrows, ncols : int, default: 1 |
| 804 | Number of rows/columns of the subplot grid. |
| 805 | |
| 806 | sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False |
| 807 | Controls sharing of x-axis (*sharex*) or y-axis (*sharey*): |
| 808 | |
| 809 | - True or 'all': x- or y-axis will be shared among all subplots. |
| 810 | - False or 'none': each subplot x- or y-axis will be independent. |
| 811 | - 'row': each subplot row will share an x- or y-axis. |
| 812 | - 'col': each subplot column will share an x- or y-axis. |
| 813 | |
| 814 | When subplots have a shared x-axis along a column, only the x tick |
| 815 | labels of the bottom subplot are created. Similarly, when subplots |
| 816 | have a shared y-axis along a row, only the y tick labels of the |
| 817 | first column subplot are created. To later turn other subplots' |
| 818 | ticklabels on, use `~matplotlib.axes.Axes.tick_params`. |
| 819 | |
| 820 | When subplots have a shared axis that has units, calling |
| 821 | `.Axis.set_units` will update each axis with the new units. |
| 822 | |
| 823 | Note that it is not possible to unshare axes. |
| 824 | |
| 825 | squeeze : bool, default: True |
| 826 | - If True, extra dimensions are squeezed out from the returned |
| 827 | array of Axes: |
| 828 | |
| 829 | - if only one subplot is constructed (nrows=ncols=1), the |
| 830 | resulting single Axes object is returned as a scalar. |
| 831 | - for Nx1 or 1xM subplots, the returned object is a 1D numpy |
| 832 | object array of Axes objects. |
| 833 | - for NxM, subplots with N>1 and M>1 are returned as a 2D array. |
| 834 | |
| 835 | - If False, no squeezing at all is done: the returned Axes object |
| 836 | is always a 2D array containing Axes instances, even if it ends |
| 837 | up being 1x1. |
| 838 | |
| 839 | width_ratios : array-like of length *ncols*, optional |
| 840 | Defines the relative widths of the columns. Each column gets a |
| 841 | relative width of ``width_ratios[i] / sum(width_ratios)``. |
| 842 | If not given, all columns will have the same width. Equivalent |
| 843 | to ``gridspec_kw={'width_ratios': [...]}``. |
| 844 | |
| 845 | height_ratios : array-like of length *nrows*, optional |
| 846 | Defines the relative heights of the rows. Each row gets a |
| 847 | relative height of ``height_ratios[i] / sum(height_ratios)``. |
| 848 | If not given, all rows will have the same height. Equivalent |
| 849 | to ``gridspec_kw={'height_ratios': [...]}``. |