From b462808101f4de89d1fe8a0d2d7afedc3650e0b8 Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Thu, 14 Mar 2024 05:25:28 +0000 Subject: [PATCH] fixing docs --- bigframes/operations/plotting.py | 2 +- .../pandas/plotting/_core.py | 51 ++++--------------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/bigframes/operations/plotting.py b/bigframes/operations/plotting.py index b754417d6c..cc9f71e5d1 100644 --- a/bigframes/operations/plotting.py +++ b/bigframes/operations/plotting.py @@ -20,7 +20,7 @@ import bigframes.operations._matplotlib as bfplt -class PlotAccessor: +class PlotAccessor(vendordt.PlotAccessor): __doc__ = vendordt.PlotAccessor.__doc__ def __init__(self, data) -> None: diff --git a/third_party/bigframes_vendored/pandas/plotting/_core.py b/third_party/bigframes_vendored/pandas/plotting/_core.py index 0a85208de7..2b0f077695 100644 --- a/third_party/bigframes_vendored/pandas/plotting/_core.py +++ b/third_party/bigframes_vendored/pandas/plotting/_core.py @@ -4,9 +4,7 @@ class PlotAccessor: - """ - Make plots of Series or DataFrame with the `matplotlib` backend. - """ + """Make plots of Series or DataFrame with the `matplotlib` backend.""" def hist( self, by: typing.Optional[typing.Sequence[str]] = None, bins: int = 10, **kwargs @@ -21,9 +19,6 @@ def hist( **Examples:** - .. plot:: - :context: close-figs - >>> import bigframes.pandas as bpd >>> import numpy as np >>> df = bpd.DataFrame(np.random.randint(1, 7, 6000), columns=['one']) @@ -61,9 +56,6 @@ def line( **Examples:** - .. plot:: - :context: close-figs - >>> import bigframes.pandas as bpd >>> df = bpd.DataFrame( ... { @@ -102,7 +94,6 @@ def line( Number of random items for plotting. sampling_random_state (int, default 0): Seed for random number generator. - **kwargs: Additional keyword arguments are documented in :meth:`DataFrame.plot`. @@ -132,9 +123,6 @@ def area( Draw an area plot based on basic business metrics: - .. plot:: - :context: close-figs - >>> import bigframes.pandas as bpd >>> df = bpd.DataFrame( ... { @@ -149,23 +137,14 @@ def area( Area plots are stacked by default. To produce an unstacked plot, pass ``stacked=False``: - .. plot:: - :context: close-figs - >>> ax = df.plot.area(stacked=False) Draw an area plot for a single column: - .. plot:: - :context: close-figs - >>> ax = df.plot.area(y='sales') Draw with a different `x`: - .. plot:: - :context: close-figs - >>> df = bpd.DataFrame({ ... 'sales': [3, 2, 3], ... 'visits': [20, 42, 28], @@ -215,9 +194,6 @@ def scatter( Let's see how to draw a scatter plot using coordinates from the values in a DataFrame's columns. - .. plot:: - :context: close-figs - >>> import bigframes.pandas as bpd >>> df = bpd.DataFrame([[5.1, 3.5, 0], [4.9, 3.0, 0], [7.0, 3.2, 1], ... [6.4, 3.2, 1], [5.9, 3.0, 2]], @@ -228,15 +204,11 @@ def scatter( And now with the color determined by a column as well. - .. plot:: - :context: close-figs - >>> ax2 = df.plot.scatter(x='length', ... y='width', ... c='species', ... colormap='viridis') - Args: x (int or str): The column name or column position to be used as horizontal @@ -248,30 +220,27 @@ def scatter( The size of each point. Possible values are: - A string with the name of the column to be used for marker's size. - - A single scalar so all points have the same size. - - A sequence of scalars, which will be used for each point's size - recursively. For instance, when passing [2,14] all points size - will be either 2 or 14, alternatively. + recursively. For instance, when passing [2,14] all points size + will be either 2 or 14, alternatively. + c (str, int or array-like, optional): The color of each point. Possible values are: - A single color string referred to by name, RGB or RGBA code, - for instance 'red' or '#a98d19'. - + for instance 'red' or '#a98d19'. - A sequence of color strings referred to by name, RGB or RGBA - code, which will be used for each point's color recursively. For - instance ['green','yellow'] all points will be filled in green or - yellow, alternatively. - + code, which will be used for each point's color recursively. For + instance ['green','yellow'] all points will be filled in green or + yellow, alternatively. - A column name or position whose values will be used to color the - marker points according to a colormap. + marker points according to a colormap. + sampling_n (int, default 100): Number of random items for plotting. sampling_random_state (int, default 0): Seed for random number generator. - **kwargs: Additional keyword arguments are documented in :meth:`DataFrame.plot`.