plot_xy
The plot_xy
method creates XY series plots using data from tables.
Syntax
plot_xy(
series_name: str,
t: Union[Table, SelectableDataSet],
x: Union[str, list[int], list[float], list[DateTime]],
y: Union[str, list[int], list[float], list[DateTime]],
x_low: Union[str, list[int], list[float], list[DateTime]] = None,
x_high: Union[str, list[int], list[float], list[DateTime]] = None,
y_low: Union[str, list[int], list[float], list[DateTime]] = None,
y_high: Union[str, list[int], list[float], list[DateTime]] = None,
function: Callable = None,
by: list[str] = None,
x_time_axis: bool = None,
y_time_axis: bool = None,
) -> Figure
Parameters
Parameter | Type | Description |
---|---|---|
series_name | str | The name you want to use 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. |
x | Union[str, list[int], list[float], list[DateTime]] | The name of the column of data to be used for the X value. |
y | Union[str, list[int], list[float], list[DateTime]] | The name of the column of data to be used for the Y value. |
x_low optional | Union[str, list[int], list[float], list[DateTime]] | Lower X error bar. |
x_high optional | Union[str, list[int], list[float], list[DateTime]] | Upper X error bar. |
y_low optional | Union[str, list[int], list[float], list[DateTime]] | Lower Y error bar. |
y_high optional | Union[str, list[int], list[float], list[DateTime]] | Upper Y error bar. |
function optional | Callable | A built-in or user-defined function. |
by optional | list[str] | Columns that hold grouping data. |
x_time_axis optional | bool | Whether to treat the X values as times. |
y_time_axis optional | bool | Whether to treat the Y values as times. |
Returns
An XY series plot with a single axes.
Examples
The following example plots data from a Deephaven table.
from deephaven import read_csv
from deephaven.plot.figure import Figure
source = read_csv(
"https://media.githubusercontent.com/media/deephaven/examples/main/MetricCentury/csv/metriccentury.csv"
)
plot_single = (
Figure()
.plot_xy(
series_name="Distance",
t=source.where(filters=["SpeedKPH > 0"]),
x="Time",
y="DistanceMeters",
)
.show()
)
- plot_single
- source