3D Line Plot

3D line plots are a data visualization technique that displays data points as connected line segments in a three-dimensional space. They are used to visualize and continuous variables that depend on two continuous independent variables, facilitating the exploration of patterns, trends, and relationships within the data.

3D line plots are appropriate when a continuous response variable depends on two continuous explanatory variables. If there is an additional categorical variable that the response variable depends on, shapes or colors can be used in the scatter plot to distinguish the categories. Further, line plots are preferable to scatter plots when the explanatory variables are ordered.

What are 3D line plots useful for?

  • Multidimensional data visualization: 3D line plots allow for the representation of data in a 3D space, providing a more comprehensive view of complex relationships.
  • Trend exploration: 3D line plots are useful for exploring and understanding trends, patterns, and variations in data within a 3D space, making them valuable in scientific and engineering fields.
  • Data interaction: They enable the visualization of data interactions within 3D datasets, aiding in the analysis of data dependencies and correlations.

Alternatives to 3D line plots include:

  • Scatter Plots with Color or Size Mapping: These can be used to represent three variables with the addition of color or size mapping to signify the third dimension.
  • Density Heatmaps: When visualizing continuous data over a 3D space, density heatmaps may be more appropriate, as they create a continuous surface representation.

Examples

A basic 3D line plot

Visualize the relationship between three variables by passing their column names to the x, y, and z arguments. Click and drag on the resulting chart to rotate it for new perspectives.

import deephaven.plot.express as dx
from deephaven import time_table

# create a simple spiral dataset
spiral = time_table("PT0.01s").update_view(
    ["X = sin(ii / 100)", "Y = cos(ii / 100)", "Z = 4 * ii / 100"]
)

line_plot_3D = dx.line_3d(spiral, x="X", y="Y", z="Z")

API Reference

Returns a 3D line chart

Returns: DeephavenFigure A DeephavenFigure that contains the 3D line chart

ParametersTypeDefaultDescription
tablePartitionedTable |
Table |
DataFrame
A table to pull data from.
xstr |
None
NoneA column that contains x-axis values.
ystr |
None
NoneA column that contains y-axis values.
zstr |
None
NoneA column that contains z-axis values.
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 size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used.
sizestr |
None
NoneA column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors.
line_dashstr |
list[str] |
None
NoneA column or list of columns that contain line_dash values. The value is used for a plot by on line_dash. See line_dash_map for additional behaviors.
widthstr |
list[str] |
None
NoneA column or list of columns that contain width values. The value is used for a plot by on width. See width_map for additional behaviors.
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.
symbolstr |
list[str] |
None
NoneA column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors.
error_xstr |
None
NoneA column with x error bar values. These form the error bars in both the positive and negative direction if error_x_minus is not specified, and the error bars in only the positive direction if error_x_minus is specified.
error_x_minusstr |
None
NoneA column with x error bar values. These form the error bars in the negative direction, and are ignored if error_x is not specified.
error_ystr |
None
NoneA column with y error bar values. These form the error bars in both the positive and negative direction if error_y_minus is not specified, and the error bars in only the positive direction if error_y_minus is specified.
error_y_minusstr |
None
NoneA column with y error bar values. These form the error bars in the negative direction, and are ignored if error_y is not specified.
error_zstr |
None
NoneA column with z error bar values. These form the error bars in both the positive and negative direction if error_z_minus is not specified, and the error bars in only the positive direction if error_z_minus is specified.
error_z_minusstr |
None
NoneA column with z error bar values. These form the error bars in the negative direction, and are ignored if error_z
textstr |
None
NoneA column that contains text annotations.
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.
line_dash_sequencelist[str] |
None
NoneA list of line dashes to sequentially apply to the series. The dashes loop, so if there are more series than dashes, dashes will be reused.
line_dash_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 line_dash.
symbol_sequencelist[str] |
None
NoneA list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused.
symbol_mapstr |
tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] |
dict[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 symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by
size_sequencelist[int] |
None
NoneA list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused.
size_mapstr |
tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] |
dict[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 sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by
width_sequencelist[int] |
None
NoneA list of widths to sequentially apply to the series. The widths loop, so if there are more series than widths, widths will be reused.
width_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 width.
markersboolFalseTrue to draw markers on the line, False to not. Default False
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.
log_zboolFalseA 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.
range_zlist[int] |
None
NoneA list of two numbers that specify the range of the z 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.