Skip to content

Type Alias: ContourTrace ​

ts
type ContourTrace = Omit<CommonTraceAttributes, 'hovertext'> & CartesianTraceAttributes & object;

Contour plot: level lines of a grid of values (uneven grids allowed), drawn as filled bands, a smooth heatmap or lines, with level labels along the lines, or constraint contours shading where the values satisfy an inequality.

Type Declaration ​

NameTypeDescription
autocolorscale?booleanPick the colorscale from the sign of the color domain (layout.colorscale.sequential, sequentialminus or diverging) instead of colorscale.
autocontour?booleanPick the contour levels automatically (at most ncontours, at nice round values). Defaults to false when contours.start and contours.end are given.
coloraxis?"coloraxis" | `coloraxis${number}`Share a colorscale and domain with other traces through layout.coloraxis ('coloraxis', 'coloraxis2', …). Overrides this trace's colorscale attributes.
colorbar?ColorbarThe colorbar of this colorscale (plan E5.3).
colorscale?| ColorScale | readonly string[] | readonly readonly (number | string)[][]Colorscale of the aggregated values: a name ('Viridis', 'RdBu', …), a list of colors, or [position, color] stops from 0 to 1. Default: Plotly's RdBu; the default holochart template uses its sequential neon plasma.
connectgaps?booleanDraw the contours across gaps (non-numeric z), which are always filled from their neighbours for contouring (Plotly’s Laplace fill). false clips the drawing to the data, leaving holes at the gaps. Default: true for 1D z, else false.
contours?ContourTraceContoursContour levels, coloring, labels and constraints.
dx?numberStep between columns when x is not given (milliseconds on date axes).
dy?numberStep between rows when y is not given (milliseconds on date axes).
fillcolor?stringFill of the shaded region of constraint contours. Default: line.color (else the trace's colorway color) at half opacity.
hoverongaps?booleanShow hover labels on gaps (grid points without a value, with connectgaps: false), with an empty z.
hovertext?DataColumnHover text per grid point (2D like z); takes precedence over text in hover.
line?ContourTraceLineContour lines.
ncontours?numberMaximum number of contour levels with autocontour (or without contours.size); the actual number is chosen to give nice round levels. Minimum: 1
reversescale?booleanReverse the colorscale (the lowest value gets the last color).
showscale?booleanShow a colorbar for the colorscale (drawn by the colorbar component).
text?DataColumnText per grid point (2D like z, or 1D with column data): shown in hover labels and as %{text} in templates.
textfont?Histogram2dTraceTextfontFont of the cell labels (texttemplate).
texttemplate?stringLabel drawn at every grid point with contours.coloring: 'heatmap': %{z}, %{x}, %{y}, %{text}, with optional d3 formats (%{z:.1f}). Empty: no labels.
transpose?booleanSwap rows and columns of a 2D z (z[column][row]).
type"contour"Trace type.
x?DataColumnX coordinates (numbers, dates or categories) of the grid points: one per column of z (extra values are ignored; missing ones continue the last step). Uneven spacing is fine. With 1D z, the x value of each point.
x0?unknownCoordinate of the first column when x is not given (or xtype: 'scaled'); the next ones step by dx.
xhoverformat?stringd3 number or date format of x values in hover labels. Default: the axis format.
xperiod?unknownOnly on date or linear x axes: snap each x value to its period of this length (ms, or 'M<n>' months on date axes), positioned per xperiodalignment.
xperiod0?unknownA period boundary for xperiod. Default: 2000-01-01 on date axes (a Sunday for weekly periods), 0 otherwise.
xperiodalignment?"start" | "middle" | "end"Where points sit within their xperiod.
xtype?"array" | "scaled"'array' (default with x): place the grid points at x; 'scaled' (default without): at x0 + i × dx.
y?DataColumnY coordinates (numbers, dates or categories) of the grid points: one per row of z (extra values are ignored; missing ones continue the last step). Uneven spacing is fine. With 1D z, the y value of each point.
y0?unknownCoordinate of the first row when y is not given (or ytype: 'scaled'); the next ones step by dy.
yhoverformat?stringd3 number or date format of y values in hover labels. Default: the axis format.
yperiod?unknownOnly on date or linear y axes: snap each y value to its period of this length (ms, or 'M<n>' months on date axes), positioned per yperiodalignment.
yperiod0?unknownA period boundary for yperiod. Default: 2000-01-01 on date axes (a Sunday for weekly periods), 0 otherwise.
yperiodalignment?"start" | "middle" | "end"Where points sit within their yperiod.
ytype?"array" | "scaled"'array' (default with y): place the grid points at y; 'scaled' (default without): at y0 + i × dy.
z?DataColumnValues to contour: a 2D array (z[row][column], rows along y), or a 1D array with x and y columns (one value per point, placed on the grid of their distinct x and y values). Non-numeric entries are gaps.
zauto?booleanCompute the color domain from the aggregated values. Defaults to false when both zmin and zmax are given.
zhoverformat?stringd3 number format of z values in hover labels (and %{z} in templates).
zmax?numberValue mapped to the last colorscale color (with zmin; turns zauto off).
zmid?numberWith zauto, widen the automatic domain so it is symmetric around this value (diverging data).
zmin?numberValue mapped to the first colorscale color (with zmax; turns zauto off).
zorder?numberStacking order among the traces of a subplot: higher is drawn on top. At equal zorder, contours draw above heatmaps and below bars and scatter traces (Plotly’s layer order).

Released under the MIT License.