Plot By

To plot multiple series from a table into a single chart, use the by parameter. This parameter accepts a column name or a list of column names denoting other variables of interest in the dataset. The chart will be partitioned by the values in the specified column(s), with one series for each unique value. Other parameters, such as color, symbol, size, width, and line_dash can also be used to partition the chart.

Under the hood, the Deephaven query engine performs a partition_by table operation on the given grouping column to create each series. This efficient implementation means that plots with multiple groups can easily scale to tens of millions or billions of rows with ease.

Examples

Scatter plot by a categorical variable

Create a scatter plot, where the color of each point is determined by a categorical grouping variable.

Or, use symbol to differentiate groups with symbols.

Scatter plot by a numeric variable

Use a numeric variable with the size parameter to change the size of the points based on the value of the numeric variable.

If the sizes are too large or small, use the size_map argument to map each numeric value to a more appropriate size.

Scatter plot by several categorical variables

Pass two or more column names to the by argument to color points based on unique combinations of values.

Alternatively, use other arguments such as symbol or size to differentiate groups.

Line plot by a categorical variable

Use a line plot to track the trends of a numeric variable over time, broken into categories using by.

In the case of a line plot, line_dash can also be used to differentiate lines for different categories.

Histogram plot by a categorical variable

Use by with histograms to visualize the distributions of multiple groups of data. Histograms can be stacked, or overlaid using barmode="overlay".

Box plot by a categorical variable

Use by with box plots to visualize the distributions of multiple groups of data. Unlike histograms, using the by argument with box plots stacks them vertically.

Violin plot by a categorical variable

Use by with violin plots to visualize the distributions of multiple groups of data. The by argument for a violin plot behaves similarly to a box plot.