Skip to content

Commit 3dd4a19

Browse files
committed
fix docstring
1 parent 1d4b67f commit 3dd4a19

File tree

2 files changed

+123
-134
lines changed

2 files changed

+123
-134
lines changed

bigframes/operations/plotting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def line(
4242
**kwargs,
4343
):
4444
return bfplt.plot(
45-
self._parent,
45+
self._parent.copy(),
4646
kind="line",
4747
x=x,
4848
y=y,

third_party/bigframes_vendored/pandas/plotting/_core.py

Lines changed: 122 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,7 @@ def hist(
1919
into bins and draws all bins in one :class:`matplotlib.axes.Axes`.
2020
This is useful when the DataFrame's Series are in a similar scale.
2121
22-
Parameters
23-
----------
24-
by : str or sequence, optional
25-
Column in the DataFrame to group by. It is not supported yet.
26-
bins : int, default 10
27-
Number of histogram bins to be used.
28-
**kwargs
29-
Additional keyword arguments are documented in
30-
:meth:`DataFrame.plot`.
31-
32-
Returns
33-
-------
34-
class:`matplotlib.AxesSubplot`
35-
Return a histogram plot.
36-
37-
Examples
38-
--------
39-
For Series:
22+
**Examples:**
4023
4124
.. plot::
4225
:context: close-figs
@@ -46,6 +29,19 @@ def hist(
4629
>>> df = bpd.DataFrame(np.random.randint(1, 7, 6000), columns=['one'])
4730
>>> df['two'] = np.random.randint(1, 7, 6000) + np.random.randint(1, 7, 6000)
4831
>>> ax = df.plot.hist(bins=12, alpha=0.5)
32+
33+
Args:
34+
by (str or sequence, optional):
35+
Column in the DataFrame to group by. It is not supported yet.
36+
bins (int, default 10):
37+
Number of histogram bins to be used.
38+
**kwargs:
39+
Additional keyword arguments are documented in
40+
:meth:`DataFrame.plot`.
41+
42+
Returns:
43+
class:`matplotlib.AxesSubplot`: A histogram plot.
44+
4945
"""
5046
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
5147

@@ -63,48 +59,7 @@ def line(
6359
of items. For consistent results, the random sampling is reproducible.
6460
Use the `sampling_random_state` parameter to modify the sampling seed.
6561
66-
Parameters
67-
----------
68-
x : label or position, optional
69-
Allows plotting of one column versus another. If not specified,
70-
the index of the DataFrame is used.
71-
y : label or position, optional
72-
Allows plotting of one column versus another. If not specified,
73-
all numerical columns are used.
74-
color : str, array-like, or dict, optional
75-
The color for each of the DataFrame's columns. Possible values are:
76-
77-
- A single color string referred to by name, RGB or RGBA code,
78-
for instance 'red' or '#a98d19'.
79-
80-
- A sequence of color strings referred to by name, RGB or RGBA
81-
code, which will be used for each column recursively. For
82-
instance ['green','yellow'] each column's %(kind)s will be filled in
83-
green or yellow, alternatively. If there is only a single column to
84-
be plotted, then only the first color from the color list will be
85-
used.
86-
87-
- A dict of the form {column name : color}, so that each column will be
88-
colored accordingly. For example, if your columns are called `a` and
89-
`b`, then passing {'a': 'green', 'b': 'red'} will color %(kind)ss for
90-
column `a` in green and %(kind)ss for column `b` in red.
91-
sampling_n: int, default 100:
92-
Number of random items for plotting.
93-
sampling_random_state: int, default 0:
94-
Seed for random number generator.
95-
96-
**kwargs
97-
Additional keyword arguments are documented in
98-
:meth:`DataFrame.plot`.
99-
100-
Returns
101-
-------
102-
matplotlib.axes.Axes or np.ndarray of them
103-
An ndarray is returned with one :class:`matplotlib.axes.Axes`
104-
per column when ``subplots=True``.
105-
106-
Examples
107-
--------
62+
**Examples:**
10863
10964
.. plot::
11065
:context: close-figs
@@ -118,6 +73,44 @@ def line(
11873
... }
11974
... )
12075
>>> ax = df.plot.line(x='one')
76+
77+
Args:
78+
x (label or position, optional):
79+
Allows plotting of one column versus another. If not specified,
80+
the index of the DataFrame is used.
81+
y (label or position, optional):
82+
Allows plotting of one column versus another. If not specified,
83+
all numerical columns are used.
84+
color (str, array-like, or dict, optional):
85+
The color for each of the DataFrame's columns. Possible values are:
86+
87+
- A single color string referred to by name, RGB or RGBA code,
88+
for instance 'red' or '#a98d19'.
89+
90+
- A sequence of color strings referred to by name, RGB or RGBA
91+
code, which will be used for each column recursively. For
92+
instance ['green','yellow'] each column's %(kind)s will be filled in
93+
green or yellow, alternatively. If there is only a single column to
94+
be plotted, then only the first color from the color list will be
95+
used.
96+
97+
- A dict of the form {column name : color}, so that each column will be
98+
colored accordingly. For example, if your columns are called `a` and
99+
`b`, then passing {'a': 'green', 'b': 'red'} will color %(kind)ss for
100+
column `a` in green and %(kind)ss for column `b` in red.
101+
sampling_n (int, default 100):
102+
Number of random items for plotting.
103+
sampling_random_state (int, default 0):
104+
Seed for random number generator.
105+
106+
**kwargs:
107+
Additional keyword arguments are documented in
108+
:meth:`DataFrame.plot`.
109+
110+
Returns:
111+
matplotlib.axes.Axes or np.ndarray of them:
112+
An ndarray is returned with one :class:`matplotlib.axes.Axes`
113+
per column when ``subplots=True``.
121114
"""
122115
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
123116

@@ -135,30 +128,8 @@ def area(
135128
of items. For consistent results, the random sampling is reproducible.
136129
Use the `sampling_random_state` parameter to modify the sampling seed.
137130
138-
Parameters
139-
----------
140-
x : label or position, optional
141-
Coordinates for the X axis. By default uses the index.
142-
y : label or position, optional
143-
Column to plot. By default uses all columns.
144-
stacked : bool, default True
145-
Area plots are stacked by default. Set to False to create a
146-
unstacked plot.
147-
sampling_n: int, default 100:
148-
Number of random items for plotting.
149-
sampling_random_state: int, default 0:
150-
Seed for random number generator.
151-
**kwargs
152-
Additional keyword arguments are documented in
153-
:meth:`DataFrame.plot`.
154-
155-
Returns
156-
-------
157-
matplotlib.axes.Axes or numpy.ndarray
158-
Area plot, or array of area plots if subplots is True.
159-
160-
Examples
161-
--------
131+
**Examples:**
132+
162133
Draw an area plot based on basic business metrics:
163134
164135
.. plot::
@@ -201,6 +172,26 @@ def area(
201172
... 'day': [1, 2, 3],
202173
... })
203174
>>> ax = df.plot.area(x='day')
175+
176+
Args:
177+
x (label or position, optional):
178+
Coordinates for the X axis. By default uses the index.
179+
y (label or position, optional):
180+
Column to plot. By default uses all columns.
181+
stacked (bool, default True):
182+
Area plots are stacked by default. Set to False to create a
183+
unstacked plot.
184+
sampling_n (int, default 100):
185+
Number of random items for plotting.
186+
sampling_random_state (int, default 0):
187+
Seed for random number generator.
188+
**kwargs:
189+
Additional keyword arguments are documented in
190+
:meth:`DataFrame.plot`.
191+
192+
Returns:
193+
matplotlib.axes.Axes or numpy.ndarray:
194+
Area plot, or array of area plots if subplots is True.
204195
"""
205196
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
206197

@@ -219,55 +210,8 @@ def scatter(
219210
of items. For consistent results, the random sampling is reproducible.
220211
Use the `sampling_random_state` parameter to modify the sampling seed.
221212
222-
Parameters
223-
224-
----------
225-
x : int or str
226-
The column name or column position to be used as horizontal
227-
coordinates for each point.
228-
y : int or str
229-
The column name or column position to be used as vertical
230-
coordinates for each point.
231-
s : str, scalar or array-like, optional
232-
The size of each point. Possible values are:
233-
234-
- A string with the name of the column to be used for marker's size.
235-
236-
- A single scalar so all points have the same size.
237-
238-
- A sequence of scalars, which will be used for each point's size
239-
recursively. For instance, when passing [2,14] all points size
240-
will be either 2 or 14, alternatively.
241-
c : str, int or array-like, optional
242-
The color of each point. Possible values are:
243-
244-
- A single color string referred to by name, RGB or RGBA code,
245-
for instance 'red' or '#a98d19'.
246-
247-
- A sequence of color strings referred to by name, RGB or RGBA
248-
code, which will be used for each point's color recursively. For
249-
instance ['green','yellow'] all points will be filled in green or
250-
yellow, alternatively.
251-
252-
- A column name or position whose values will be used to color the
253-
marker points according to a colormap.
254-
sampling_n: int, default 100:
255-
Number of random items for plotting.
256-
sampling_random_state: int, default 0:
257-
Seed for random number generator.
258-
259-
**kwargs
260-
Additional keyword arguments are documented in
261-
:meth:`DataFrame.plot`.
262-
263-
Returns
264-
-------
265-
matplotlib.axes.Axes or np.ndarray of them
266-
An ndarray is returned with one :class:`matplotlib.axes.Axes`
267-
per column when ``subplots=True``.
268-
269-
Examples
270-
--------
213+
**Examples:**
214+
271215
Let's see how to draw a scatter plot using coordinates from the values
272216
in a DataFrame's columns.
273217
@@ -291,5 +235,50 @@ def scatter(
291235
... y='width',
292236
... c='species',
293237
... colormap='viridis')
238+
239+
240+
Args:
241+
x (int or str):
242+
The column name or column position to be used as horizontal
243+
coordinates for each point.
244+
y (int or str):
245+
The column name or column position to be used as vertical
246+
coordinates for each point.
247+
s (str, scalar or array-like, optional):
248+
The size of each point. Possible values are:
249+
250+
- A string with the name of the column to be used for marker's size.
251+
252+
- A single scalar so all points have the same size.
253+
254+
- A sequence of scalars, which will be used for each point's size
255+
recursively. For instance, when passing [2,14] all points size
256+
will be either 2 or 14, alternatively.
257+
c (str, int or array-like, optional):
258+
The color of each point. Possible values are:
259+
260+
- A single color string referred to by name, RGB or RGBA code,
261+
for instance 'red' or '#a98d19'.
262+
263+
- A sequence of color strings referred to by name, RGB or RGBA
264+
code, which will be used for each point's color recursively. For
265+
instance ['green','yellow'] all points will be filled in green or
266+
yellow, alternatively.
267+
268+
- A column name or position whose values will be used to color the
269+
marker points according to a colormap.
270+
sampling_n (int, default 100):
271+
Number of random items for plotting.
272+
sampling_random_state (int, default 0):
273+
Seed for random number generator.
274+
275+
**kwargs:
276+
Additional keyword arguments are documented in
277+
:meth:`DataFrame.plot`.
278+
279+
Returns:
280+
matplotlib.axes.Axes or np.ndarray of them:
281+
An ndarray is returned with one :class:`matplotlib.axes.Axes`
282+
per column when ``subplots=True``.
294283
"""
295284
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

0 commit comments

Comments
 (0)