plot_treemap
The plot_treemap
method creates treemap charts using data from Deephaven tables.
Syntax
plot_treemap(
series_name: str,
t: Union[Table, SelectableDataSet],
id: str,
parent: str,
label: str = None,
value: str = None,
hover_text: str = None,
color: str = None,
) -> tree map
Parameters
Parameter | Type | Description |
---|---|---|
series_name | str | The name (as a String) to identify the series on the plot itself. |
t | Union[Table, SelectableDataSet] | The table (or other selectable data set) that holds the data to be plotted. |
id | str | The name of the column containing ID values. |
parent | str | The name of the column containing parent ID values. |
label optional | str | The name of the column containing labels. If not provided, labels default to the ID value. |
value optional | str | The name of the column containing values for how large each section in relation to other sections. |
hover_text optional | str | The name of the column containing hover text shown when hovering over a section in the treemap. |
color optional | str | The name of the column containing hexadecimal color to use for each section. |
Returns
A treemap chart.
Examples
The following example plots data from a Deephaven table.
from deephaven import read_csv
from deephaven.plot.figure import Figure
# source the data
source = read_csv(
"https://media.githubusercontent.com/media/deephaven/examples/main/StandardAndPoors500Financials/csv/s_and_p_500_market_cap.csv"
)
# plot the data
s_and_p = (
Figure()
.plot_treemap(
series_name="S&P 500 Companies by Sector", t=source, id="Label", parent="Parent"
)
.show()
)
- s_and_p
- source
In the following example, plot_treemap
is used to plot data from a Deephaven table, including the optional label
, value
, hover_text
, and color
parameters.
from deephaven import read_csv
from deephaven.plot.figure import Figure
# source the data
source = read_csv(
"https://media.githubusercontent.com/media/deephaven/examples/main/StandardAndPoors500Financials/csv/s_and_p_500_market_cap.csv"
)
# plot the data
s_and_p_marketcap = (
Figure()
.plot_treemap(
series_name="S&P 500 Market Cap",
t=source,
id="Label",
parent="Parent",
label="Label",
value="Value",
hover_text="HoverText",
color="Color",
)
.show()
)
- s_and_p_marketcap
- source