|
6 | 6 | class PlotAccessor:
|
7 | 7 | """
|
8 | 8 | Make plots of Series or DataFrame with the `matplotlib` backend.
|
| 9 | +
|
| 10 | + Parameters |
| 11 | + ---------- |
| 12 | + data : Series or DataFrame |
| 13 | + The object for which the method is called. |
| 14 | + kind : str |
| 15 | + The kind of plot to produce: |
| 16 | +
|
| 17 | + - 'line' : line plot (default) |
| 18 | + - 'hist' : histogram |
| 19 | + - 'area' : area plot |
| 20 | + - 'scatter' : scatter plot (DataFrame only) |
| 21 | + ax : matplotlib axes object, default None |
| 22 | + An axes of the current figure. |
| 23 | + subplots : bool or sequence of iterables, default False |
| 24 | + Whether to group columns into subplots: |
| 25 | +
|
| 26 | + - ``False`` : No subplots will be used |
| 27 | + - ``True`` : Make separate subplots for each column. |
| 28 | + - sequence of iterables of column labels: Create a subplot for each |
| 29 | + group of columns. For example `[('a', 'c'), ('b', 'd')]` will |
| 30 | + create 2 subplots: one with columns 'a' and 'c', and one |
| 31 | + with columns 'b' and 'd'. Remaining columns that aren't specified |
| 32 | + will be plotted in additional subplots (one per column). |
| 33 | +
|
| 34 | + .. versionadded:: 1.5.0 |
| 35 | +
|
| 36 | + sharex : bool, default True if ax is None else False |
| 37 | + In case ``subplots=True``, share x axis and set some x axis labels |
| 38 | + to invisible; defaults to True if ax is None otherwise False if |
| 39 | + an ax is passed in; Be aware, that passing in both an ax and |
| 40 | + ``sharex=True`` will alter all x axis labels for all axis in a figure. |
| 41 | + sharey : bool, default False |
| 42 | + In case ``subplots=True``, share y axis and set some y axis labels to invisible. |
| 43 | + layout : tuple, optional |
| 44 | + (rows, columns) for the layout of subplots. |
| 45 | + figsize : a tuple (width, height) in inches |
| 46 | + Size of a figure object. |
| 47 | + use_index : bool, default True |
| 48 | + Use index as ticks for x axis. |
| 49 | + title : str or list |
| 50 | + Title to use for the plot. If a string is passed, print the string |
| 51 | + at the top of the figure. If a list is passed and `subplots` is |
| 52 | + True, print each item in the list above the corresponding subplot. |
| 53 | + grid : bool, default None (matlab style default) |
| 54 | + Axis grid lines. |
| 55 | + legend : bool or {'reverse'} |
| 56 | + Place legend on axis subplots. |
| 57 | + style : list or dict |
| 58 | + The matplotlib line style per column. |
| 59 | + logx : bool or 'sym', default False |
| 60 | + Use log scaling or symlog scaling on x axis. |
| 61 | +
|
| 62 | + logy : bool or 'sym' default False |
| 63 | + Use log scaling or symlog scaling on y axis. |
| 64 | +
|
| 65 | + loglog : bool or 'sym', default False |
| 66 | + Use log scaling or symlog scaling on both x and y axes. |
| 67 | +
|
| 68 | + xticks : sequence |
| 69 | + Values to use for the xticks. |
| 70 | + yticks : sequence |
| 71 | + Values to use for the yticks. |
| 72 | + xlim : 2-tuple/list |
| 73 | + Set the x limits of the current axes. |
| 74 | + ylim : 2-tuple/list |
| 75 | + Set the y limits of the current axes. |
| 76 | + xlabel : label, optional |
| 77 | + Name to use for the xlabel on x-axis. Default uses index name as xlabel, or the |
| 78 | + x-column name for planar plots. |
| 79 | +
|
| 80 | + .. versionchanged:: 1.2.0 |
| 81 | +
|
| 82 | + Now applicable to planar plots (`scatter`, `hexbin`). |
| 83 | +
|
| 84 | + .. versionchanged:: 2.0.0 |
| 85 | +
|
| 86 | + Now applicable to histograms. |
| 87 | +
|
| 88 | + ylabel : label, optional |
| 89 | + Name to use for the ylabel on y-axis. Default will show no ylabel, or the |
| 90 | + y-column name for planar plots. |
| 91 | +
|
| 92 | + .. versionchanged:: 1.2.0 |
| 93 | +
|
| 94 | + Now applicable to planar plots (`scatter`, `hexbin`). |
| 95 | +
|
| 96 | + .. versionchanged:: 2.0.0 |
| 97 | +
|
| 98 | + Now applicable to histograms. |
| 99 | +
|
| 100 | + rot : float, default None |
| 101 | + Rotation for ticks (xticks for vertical, yticks for horizontal |
| 102 | + plots). |
| 103 | + fontsize : float, default None |
| 104 | + Font size for xticks and yticks. |
| 105 | + colormap : str or matplotlib colormap object, default None |
| 106 | + Colormap to select colors from. If string, load colormap with that |
| 107 | + name from matplotlib. |
| 108 | + colorbar : bool, optional |
| 109 | + If True, plot colorbar (only relevant for 'scatter' and 'hexbin' |
| 110 | + plots). |
| 111 | + position : float |
| 112 | + Specify relative alignments for bar plot layout. |
| 113 | + From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 |
| 114 | + (center). |
| 115 | + table : bool, Series or DataFrame, default False |
| 116 | + If True, draw a table using the data in the DataFrame and the data |
| 117 | + will be transposed to meet matplotlib's default layout. |
| 118 | + If a Series or DataFrame is passed, use passed data to draw a |
| 119 | + table. |
| 120 | + yerr : DataFrame, Series, array-like, dict and str |
| 121 | + See :ref:`Plotting with Error Bars <visualization.errorbars>` for |
| 122 | + detail. |
| 123 | + xerr : DataFrame, Series, array-like, dict and str |
| 124 | + Equivalent to yerr. |
| 125 | + stacked : bool, default False in line and bar plots, and True in area plot |
| 126 | + If True, create stacked plot. |
| 127 | + secondary_y : bool or sequence, default False |
| 128 | + Whether to plot on the secondary y-axis if a list/tuple, which |
| 129 | + columns to plot on secondary y-axis. |
| 130 | + mark_right : bool, default True |
| 131 | + When using a secondary_y axis, automatically mark the column |
| 132 | + labels with "(right)" in the legend. |
| 133 | + include_bool : bool, default is False |
| 134 | + If True, boolean values can be plotted. |
| 135 | + **kwargs |
| 136 | + Options to pass to matplotlib plotting method. |
| 137 | +
|
| 138 | + Returns |
| 139 | + ------- |
| 140 | + :class:`matplotlib.axes.Axes` or numpy.ndarray of them |
| 141 | +
|
| 142 | + Notes |
| 143 | + ----- |
| 144 | + - See matplotlib documentation online for more on this subject |
| 145 | +
|
| 146 | + Examples |
| 147 | + -------- |
| 148 | + For Series: |
| 149 | +
|
| 150 | + .. plot:: |
| 151 | + :context: close-figs |
| 152 | +
|
| 153 | + >>> import bigframes.pandas as bpd |
| 154 | + >>> ser = bpd.Series([1, 2, 3, 3]) |
| 155 | + >>> plot = ser.plot(kind='hist', title="My plot") |
| 156 | +
|
| 157 | + For DataFrame: |
| 158 | +
|
| 159 | + .. plot:: |
| 160 | + :context: close-figs |
| 161 | +
|
| 162 | + >>> df = bpd.DataFrame({'length': [1.5, 0.5, 1.2, 0.9, 3], |
| 163 | + ... 'width': [0.7, 0.2, 0.15, 0.2, 1.1]}, |
| 164 | + ... index=['pig', 'rabbit', 'duck', 'chicken', 'horse']) |
| 165 | + >>> plot = df.plot(title="DataFrame Plot") |
9 | 166 | """
|
10 | 167 |
|
| 168 | + |
11 | 169 | def hist(
|
12 | 170 | self, by: typing.Optional[typing.Sequence[str]] = None, bins: int = 10, **kwargs
|
13 | 171 | ):
|
|
0 commit comments