code: def plot_kde(data: Union["ps.DataFrame", "ps.Series"], **kwargs):
      from plotly import express
      import pyspark.pandas as ps
  
      if isinstance(data, ps.DataFrame) and "color" not in kwargs:
          kwargs["color"] = "names"
  
      psdf = KdePlotBase.prepare_kde_data(data)
      sdf = psdf._internal.spark_frame
      data_columns = psdf._internal.data_spark_columns
      ind = KdePlotBase.get_ind(
          sdf.select(*data_columns), kwargs.pop("ind", None)
      )
      bw_method = kwargs.pop("bw_method", None)
  
      pdfs = []
      for label in psdf._internal.column_labels:
          pdfs.append(
              pd.DataFrame(
                  {
                      "Density": KdePlotBase.compute_kde(
                          sdf.select(
                              psdf._internal.spark_column_for(label)
                          ),
                          ind=ind,
                          bw_method=bw_method,
                      ),
                      "names": name_like_string(label),
                      "index": ind,
                  }
              )
          )
      pdf = pd.concat(pdfs)
  
      fig = express.line(pdf, x="index", y="Density", **kwargs)
      fig["layout"]["xaxis"]["title"] = None
      return fig
  
file_path: spark/python/pyspark/pandas/plot/plotly.py
imports: import inspect
  from typing import TYPE_CHECKING, Union
  import pandas
  from pyspark.pandas.plot import HistogramPlotBase, name_like_string, PandasOnSparkPlotAccessor, BoxPlotBase, KdePlotBase
label_desc: Use image node_id 5 for calling a global function with example usage: plot_kde(data) and returns: fig