xinrong-meng opened a new pull request, #48492:
URL: https://github.com/apache/spark/pull/48492

   ### What changes were proposed in this pull request?
   Support kde/density plots with plotly backend on both Spark Connect and 
Spark classic.
   
   
   ### Why are the changes needed?
   While Pandas on Spark supports plotting, PySpark currently lacks this 
feature. The proposed API will enable users to generate visualizations. This 
will provide users with an intuitive, interactive way to explore and understand 
large datasets directly from PySpark DataFrames, streamlining the data analysis 
workflow in distributed environments.
   
   See more at [PySpark Plotting API 
Specification](https://docs.google.com/document/d/1IjOEzC8zcetG86WDvqkereQPj_NGLNW7Bdu910g30Dg/edit?usp=sharing)
 in progress.
   
   Part of https://issues.apache.org/jira/browse/SPARK-49530.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. Box plots are supported as shown below.
   
   ```py
   >>> data = [
   ...     (1.0, 4.0),
   ...     (2.0, 4.0),
   ...     (2.5, 4.5),
   ...     (3.0, 5.0),
   ...     (3.5, 5.5),
   ...     (4.0, 6.0),
   ...     (5.0, 6.0)
   ... ]
   >>> columns = ["x", "y"]
   >>> df = spark.createDataFrame(data, columns)
   >>> fig1 = df.plot.kde(column=["x", "y"], bw_method=0.3, ind=5)
   >>> fig1.show()  # see below
   >>> fig2 = df.plot(kind="kde", column="x", bw_method=0.3, ind=5)
   >>> fig2.show()  # see below
   ```
   
   fig1:
   ![newplot 
(20)](https://github.com/user-attachments/assets/d5aa8b57-b435-4a66-9e25-f37bb77f7fd8)
   
   fig2:
   ![newplot 
(21)](https://github.com/user-attachments/assets/3189417b-2739-485e-9c71-ff48d2c19964)
   
   
   
   ### How was this patch tested?
   Unit tests.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to