Strip Plot

In a strip plot, individual data points are displayed along a single axis, providing a clear view of the distribution of data points without the additional density estimation and summary statistics provided by a violin plot. By default, the plotted categories are ordered by their appearance in the dataset.

Strip plots are appropriate when the data contain a continuous variable of interest. If there is an additional categorical variable that the variable of interest depends on, stacked strip plots may be appropriate. The data should be relatively sparse, as strip plots can get crowded quickly with large datasets. This may make it difficult to spot multimodal distributions, heavy-tailed distributions, or outliers. In such cases, box plots or violin plots may be more appropriate.

What are strip plots useful for?

  • Comparing data categories: Strip plots effectively present the distribution of a dataset, and make it easy to compare the distributions of different categories of data.
  • Identifying outliers: Because strip plots are made up of individual points, they are well-suited for identifying potential outliers in datasets.
  • Small to moderate dataset visualization: Strip plots are suitable for visualizing the distribution of small to moderate-sized datasets, where individual data points can be effectively represented.

Examples

A basic strip plot

Visualize the distribution of a continuous variable by passing its column name to the x or y arguments.

import deephaven.plot.express as dx
tips = dx.data.tips()

# subset to get a single group
thursday_tips = tips.where("Day == `Thur`")

strip_plot = dx.strip(thursday_tips, x="TotalBill", color_discrete_sequence=["lightgreen"])

Distributions for multiple groups

Strip plots are useful for comparing the distributions of two or more groups of data. Pass the name of the grouping column(s) to the by argument.

import deephaven.plot.express as dx
tips = dx.data.tips()

strip_plot_group = dx.strip(tips, x="TotalBill", by="Day", color_discrete_sequence=["lightgreen", "lightblue", "goldenrod", "lightcoral"])

Note

At the moment, color_discrete_sequence must be specified explicitly to get the points to render.

API Reference

Returns a strip chart

Returns: DeephavenFigure A DeephavenFigure that contains the strip chart

ParametersTypeDefaultDescription
tablePartitionedTable |
Table |
DataFrame
A table to pull data from.
xstr |
list[str] |
None
NoneA column or list of columns that contain x-axis values. If both x and y are specified, one should be numerical and the other categorical. If x is numerical, the violins are drawn horizontally.
ystr |
list[str] |
None
NoneA column or list of columns that contain y-axis values. If both x and y are specified, one should be numerical and the other categorical. If y is numerical, the violins are drawn vertically.
bystr |
list[str] |
None
NoneA column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified
by_varsstr |
list[str]
'color'A string or list of string that contain design elements to plot by. Can contain color. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used.
colorstr |
list[str] |
None
NoneA column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors.
hover_namestr |
None
NoneA column that contains names to bold in the hover tooltip.
labelsdict[str, str] |
None
NoneA dictionary of labels mapping columns to new labels.
color_discrete_sequencelist[str] |
None
NoneA list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused.
color_discrete_mapdict[str | tuple[str], str] |
None
NoneIf dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors.
stripmodebool |
str
'group'Default 'group', which draws the strips next to each other or 'overlay' which draws them on top of each other.
log_xboolFalseA boolean that specifies if the corresponding axis is a log axis or not.
log_yboolFalseA boolean that specifies if the corresponding axis is a log axis or not.
range_xlist[int] |
None
NoneA list of two numbers that specify the range of the x-axis.
range_ylist[int] |
None
NoneA list of two numbers that specify the range of the y-axis.
titlestr |
None
NoneThe title of the chart
templatestr |
None
NoneThe template for the chart.
unsafe_update_figureCallable<function default_callback>An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. Note that the existing data traces should not be removed. This may lead to unexpected behavior if traces are modified in a way that break data mappings.