pyspark.sql.plot.core.PySparkPlotAccessor.line#
- PySparkPlotAccessor.line(x, y, **kwargs)[source]#
Plot DataFrame as lines.
- Parameters
- xstr
Name of column to use for the horizontal axis.
- ystr or list of str
Name(s) of the column(s) to use for the vertical axis. Multiple columns can be plotted.
- **kwargsoptional
Additional keyword arguments.
- Returns
plotly.graph_objs.Figure
Examples
>>> data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)] >>> columns = ["category", "int_val", "float_val"] >>> df = spark.createDataFrame(data, columns) >>> df.plot.line(x="category", y="int_val") >>> df.plot.line(x="category", y=["int_val", "float_val"])