Skip to content

Commit

Permalink
[SPARK-50646][PYTHON][DOCS] Document explicit style of pyspark plotting
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Document explicit style of pyspark plotting.

### Why are the changes needed?
To improve documentation by explicitly showing both chaining (df.plot.line(...)) and explicit (df.plot(kind="line", ...)) styles, ensuring clarity for users

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Existing tests.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #49265 from xinrong-meng/pyplot.

Authored-by: Xinrong Meng <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
  • Loading branch information
xinrong-meng authored and zhengruifeng committed Dec 23, 2024
1 parent 08675b1 commit 876450c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6785,6 +6785,9 @@ def plot(self) -> "PySparkPlotAccessor":
Notes
-----
This API is experimental.
It provides two ways to create plots:
1. Chaining style (e.g., `df.plot.line(...)`).
2. Explicit style (e.g., `df.plot(kind="line", ...)`).
Examples
--------
Expand All @@ -6794,6 +6797,7 @@ def plot(self) -> "PySparkPlotAccessor":
>>> type(df.plot)
<class 'pyspark.sql.plot.core.PySparkPlotAccessor'>
>>> df.plot.line(x="category", y=["int_val", "float_val"]) # doctest: +SKIP
>>> df.plot(kind="line", x="category", y=["int_val", "float_val"]) # doctest: +SKIP
"""
...

Expand Down

0 comments on commit 876450c

Please sign in to comment.