plot_xy_hist

The plot_xy_hist method creates XY histograms using data from Deephaven tables or arrays.

Syntax

plot_xy_hist(
    series_name: str,
    t: Union[Table, SelectableDataSet],
    x: Union[str, List[int], List[float], List[DateTime]],
    nbins: int,
    xmin: float = None,
    xmax: float = None,
) -> Figure

Parameters

ParameterTypeDescription
series_namestr

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

tUnion[Table, SelectableDataSet]

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

xUnion[str, list[int], list[float], list[DateTime]]

The name of the column containing the discrete values. This parameter is a list only when data is not sourced from a table; otherwise, it will be an array.

nbinsint

The number of intervals (bins) to use in the chart.

xmin optionalfloat

The minimum value in the X column to plot.

xmax optionalfloat

The maximum value in the X column to plot.

Returns

A histogram.

Examples

The following example plots data from a Deephaven table.

from deephaven.plot.figure import Figure
from deephaven import new_table
from deephaven.column import int_col

source = new_table([int_col("Values", [1, 2, 2, 3, 3, 3, 4, 4, 5])])

new_plot = (
    Figure()
    .plot_xy_hist(series_name="Histogram Values", t=source, x="Values", nbins=5)
    .chart_title(title="Histogram of Values")
    .show()
)

The following example plots data from an array.

from deephaven.plot.figure import Figure

import numpy as np

np_source = np.array([1, 2, 2, 3, 3, 3, 4, 4, 5])

new_plot = (
    Figure()
    .plot_xy_hist(
        series_name="Histogram Values", x=list(np_source), xmin=2.0, xmax=4.0, nbins=5
    )
    .chart_title(title="Histogram of Values")
    .show()
)