Contourcarpet
Overview
The contourcarpet
trace type is used to create contour plots over a carpet plot. It combines the advantages of contour plots with the flexible grid system of carpet plots. This trace is useful for visualizing 3D data on non-uniform or irregular grids, often seen in engineering, physics, or other technical applications.
You can control contour levels, colors, and other properties to display data patterns over an underlying carpet plot.
Common Uses
- Distorted Grids: Visualizing data over irregular grids or non-linear spaces.
- Engineering Data: Representing data that spans across irregular dimensions.
- Multivariate Visualization: Handling data with multiple independent variables.
Check out the Attributes for the full set of configuration options
Examples
Common Configurations
Here's a simple contourcarpet
plot showing a contour over a basic carpet plot:
You can copy this code below to create this chart in your project:
models:
- name: contourcarpet-data
args:
- echo
- |
a,b,x,y,z
1,1,2,3,10
2,1,3,4,15
3,1,4,5,20
1,2,5,6,25
2,2,6,7,30
3,2,7,8,35
1,3,8,9,40
2,3,9,10,45
3,3,10,11,50
traces:
- name: Carpet Plot
model: ${ref(contourcarpet-data)}
props:
type: carpet
a: ?{a}
b: ?{b}
x: ?{x}
y: ?{y}
- name: Simple Contourcarpet Plot
model: ${ref(contourcarpet-data)}
props:
type: contourcarpet
carpet: ${ref(Carpet Plot)}
z: ?{z}
colorscale: "Viridis"
charts:
- name: Simple Contourcarpet Chart
traces:
- ${ref(Simple Contourcarpet Plot)}
- ${ref(Carpet Plot)}
layout:
title:
text: Simple Contourcarpet Plot<br><sub>Contour Plot over a Carpet</sub>
xaxis:
title:
text: "X Axis"
yaxis:
title:
text: "Y Axis"
This example shows a filled contourcarpet plot, where the contours are filled with colors:
Here's the code:
models:
- name: contourcarpet-data-filled
args:
- echo
- |
a,b,x,y,z
0,0,2,3,5
1,0,3,4,10
2,0,4,5,15
0,1,5,6,20
1,1,6,7,25
2,1,7,8,30
0,2,8,9,35
1,2,9,10,40
2,2,10,11,45
traces:
- name: Carpet Plot Filled
model: ${ref(contourcarpet-data-filled)}
props:
type: carpet
a: ?{a}
b: ?{b}
x: ?{x}
y: ?{y}
- name: Filled Contourcarpet Plot
model: ${ref(contourcarpet-data-filled)}
props:
type: contourcarpet
carpet: ${ref(Carpet Plot Filled)}
z: ?{z}
colorscale: "Earth"
contours:
coloring: "heatmap"
showlines: true
charts:
- name: Filled Contourcarpet Chart
traces:
- ${ref(Filled Contourcarpet Plot)}
- ${ref(Carpet Plot Filled)}
layout:
title:
text: Filled Contourcarpet Plot<br><sub>Filled Contour Plot over a Carpet</sub>
xaxis:
title:
text: "X Axis"
yaxis:
title:
text: "Y Axis"
This example demonstrates how to customize contour levels and coloring in a contourcarpet
plot:
Here's the code:
models:
- name: contourcarpet-data-custom
args:
- echo
- |
a,b,x,y,z
0,0,1,1,10
1,0,2,2,20
2,0,3,3,30
0,1,4,4,40
1,1,5,5,50
2,1,6,6,60
0,2,7,7,70
1,2,8,8,80
2,2,9,9,90
traces:
- name: Carpet Plot Custom
model: ${ref(contourcarpet-data-custom)}
props:
type: carpet
a: ?{a}
b: ?{b}
x: ?{x}
y: ?{y}
- name: Custom Contourcarpet Plot
model: ${ref(contourcarpet-data-custom)}
props:
type: contourcarpet
carpet: ${ref(Carpet Plot Custom)}
z: ?{z}
colorscale: "Jet"
contours:
start: 10
end: 90
size: 10
charts:
- name: Custom Contourcarpet Chart
traces:
- ${ref(Custom Contourcarpet Plot)}
- ${ref(Carpet Plot Custom)}
layout:
title:
text: Custom Contourcarpet Plot<br><sub>Customized Contour Levels on a Carpet</sub>
xaxis:
title:
text: "X Axis"
yaxis:
title:
text: "Y Axis"
A schema to validate plotly trace properties
Attributes
These attributes apply to traces where trace.props.type
is set to contourcarpet
. You would configure these attributes on the trace with the trace.props
object.
a: array
asrc: 'string' #(1)!
atype: any
autocolorscale: boolean
autocontour: boolean
b: array
bsrc: 'string' #(2)!
btype: any
carpet: 'string' #(3)!
coloraxis: string
colorbar:
bgcolor: any
bordercolor: any
borderwidth: number
exponentformat: any
len: number
lenmode: any
minexponent: number
nticks: integer
orientation: any
outlinecolor: any
outlinewidth: number
separatethousands: boolean
showexponent: any
showticklabels: boolean
showtickprefix: any
showticksuffix: any
thickness: number
thicknessmode: any
tickangle: number
tickcolor: any
tickfont:
color: any
family: 'string' #(4)!
lineposition: any
shadow: 'string' #(5)!
size: number
style: any
textcase: any
variant: any
weight: integer
tickformat: 'string' #(6)!
tickformatstops: array
ticklabeloverflow: any
ticklabelposition: any
ticklabelstep: integer
ticklen: number
tickmode: any
tickprefix: 'string' #(7)!
ticks: any
ticksuffix: 'string' #(8)!
ticktext: array
ticktextsrc: 'string' #(9)!
tickvals: array
tickvalssrc: 'string' #(10)!
tickwidth: number
title:
font:
color: any
family: 'string' #(11)!
lineposition: any
shadow: 'string' #(12)!
size: number
style: any
textcase: any
variant: any
weight: integer
side: any
text: 'string' #(13)!
x: number
xanchor: any
xpad: number
xref: any
y: number
yanchor: any
ypad: number
yref: any
colorscale: any
contours:
coloring: any
end: number
impliedEdits: any
labelfont:
color: any
family: 'string' #(14)!
lineposition: any
shadow: 'string' #(15)!
size: number
style: any
textcase: any
variant: any
weight: integer
labelformat: 'string' #(16)!
operation: any
showlabels: boolean
showlines: boolean
size: number
start: number
type: any
customdata: array
customdatasrc: 'string' #(17)!
da: number
db: number
fillcolor: any
hovertext: array
hovertextsrc: 'string' #(18)!
ids: array
idssrc: 'string' #(19)!
legend: string
legendgroup: 'string' #(20)!
legendgrouptitle:
font:
color: any
family: 'string' #(21)!
lineposition: any
shadow: 'string' #(22)!
size: number
style: any
textcase: any
variant: any
weight: integer
text: 'string' #(23)!
legendrank: number
legendwidth: number
line:
color: any
dash: 'string' #(24)!
smoothing: number
width: number
metasrc: 'string' #(25)!
name: 'string' #(26)!
ncontours: integer
opacity: number
reversescale: boolean
showlegend: boolean
showscale: boolean
stream:
maxpoints: number
token: 'string' #(27)!
text: array
textsrc: 'string' #(28)!
transpose: boolean
type: contourcarpet
uid: 'string' #(29)!
visible: any
xaxis: string
yaxis: string
z: array
zauto: boolean
zmax: number
zmid: number
zmin: number
zorder: integer
zsrc: 'string' #(30)!
- Sets the source reference on Chart Studio Cloud for
a
. - Sets the source reference on Chart Studio Cloud for
b
. - The
carpet
of the carpet axes on which this contour trace lies - HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: %h for half of the year as a decimal number as well as %{n}f for fractional seconds with n digits. For example, 2016-10-13 09:15:23.456 with tickformat %H~%M~%S.%2f would display 09~15~23.46
- Sets a tick label prefix.
- Sets a tick label suffix.
- Sets the source reference on Chart Studio Cloud for
ticktext
. - Sets the source reference on Chart Studio Cloud for
tickvals
. - HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the title of the color bar.
- HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the contour label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format.
- Sets the source reference on Chart Studio Cloud for
customdata
. - Sets the source reference on Chart Studio Cloud for
hovertext
. - Sets the source reference on Chart Studio Cloud for
ids
. - Sets the legend group for this trace. Traces and shapes part of the same legend group hide/show at the same time when toggling legend items.
- HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the title of the legend group.
- Sets the dash style of lines. Set to a dash type string (solid, dot, dash, longdash, dashdot, or longdashdot) or a dash length list in px (eg 5px,10px,2px,2px).
- Sets the source reference on Chart Studio Cloud for
meta
. - Sets the trace name. The trace name appears as the legend item and on hover.
- The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.
- Sets the source reference on Chart Studio Cloud for
text
. - Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
- Sets the source reference on Chart Studio Cloud for
z
.