Skip to content

Latest commit

 

History

History
103 lines (72 loc) · 2.48 KB

histPlot.md

File metadata and controls

103 lines (72 loc) · 2.48 KB
title 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

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 the discrete values. This parameter is a list only when data is not sourced from a table; otherwise, it will be an array.

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

The minimum value in the X column to plot.

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()
)

Related documentation