Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 1.88 KB

piePlot.md

File metadata and controls

77 lines (55 loc) · 1.88 KB
title plot_pie

The plot_pie method creates pie charts using data from Deephaven tables.

Syntax

plot_pie(
    series_name: str,
    t: Union[Table, SelectableDataSet],
    category: Union[str, list[int], list[float]],
    y: Union[str, list[int], list[float], list[DateTime]],
) -> Figure

Parameters

The name (as a String) you want to use to identify the series on the plot itself.

The table (or other selectable data set) that holds the data to be plotted.

The name of the column containing category values.

The name of the column containing discrete values.

Returns

A pie chart.

Examples

The following example plots data from a Deephaven table.

from deephaven.plot.figure import Figure
from deephaven import read_csv

insurance = read_csv(
    "https://media.githubusercontent.com/media/deephaven/examples/main/Insurance/csv/insurance.csv"
)
insurance_by_region = insurance.view(formulas=["region", "expenses"]).sum_by(["region"])

new_plot = (
    Figure()
    .plot_pie(
        series_name="Insurance charges by region",
        t=insurance_by_region,
        category="region",
        y="expenses",
    )
    .chart_title(title="Expenses per region")
    .show()
)

Related documentation