Skip to main content
Version: Java (Groovy)

plot

The plot method creates XY series plots using data from tables.

Syntax

plot(seriesName, x, y)
plot(seriesName, function)
plot(seriesName, t, x, y)
plot(seriesName, x, y, hasXTimeAxis, hasYTimeAxis)
plot(seriesName, sds, x, y)

Parameters

ParameterTypeDescription
seriesNameString

The name you want to use to identify the series on the plot itself.

tTable

The table.

sdsSelectableDataSet

Selectable data set (e.g. OneClick filterable table).

xString

The column in t or sds that contains the X variable data.

xdouble[]

X values.

xfloat[]

X values.

xint[]

X values.

xlong[]

X values.

xshort[]

X values.

xIndexableNumericData[]

X values.

xDateTime[]

X values.

xDate[]

X values.

xList<T>

X values.

x<T>[]

X values.

yString

The column in t or sds that contains the Y variable data.

ydouble[]

Y values.

yfloat[]

Y values.

yint[]

Y values.

ylong[]

Y values.

yshort[]

Y values.

yIndexableNumericData[]

Y values.

yDateTime[]

Y values.

yDate[]

Y values.

yList<T>

Y values.

y<T>[]

Y values.

hasXTimeAxisboolean

Whether or not to treat the X values as time data.

hasYTimeAxisboolean

Whether or not to treat the Y values as time data.

functiongroovy.lang.CLosure<T>

Function to plot.

functionDoubleUnaryOperator

Function to plot.

Returns

An XY series plot with a single axes.

Examples

The following example plots data from a Deephaven table.

import static io.deephaven.csv.CsvTools.readCsv

//source the data
source = readCsv("https://media.githubusercontent.com/media/deephaven/examples/main/MetricCentury/csv/metriccentury.csv")

//plot the data
plot_single = plot("Distance", source.where("SpeedKPH > 0"), "Time", "DistanceMeters").show()