|
| 1 | +--- |
| 2 | +Title: '.Carpet()' |
| 3 | +Description: 'Creates visualization technique that displays interaction between variables' |
| 4 | +Subjects: |
| 5 | + - 'Data Science' |
| 6 | + - 'Data Visualization' |
| 7 | +Tags: |
| 8 | + - 'Data' |
| 9 | + - 'Finance' |
| 10 | + - 'Plotly' |
| 11 | + - 'Graphs' |
| 12 | + - 'Data Visualization' |
| 13 | +CatalogContent: |
| 14 | + - 'learn-python-3' |
| 15 | + - 'paths/data-visualization' |
| 16 | +--- |
| 17 | + |
| 18 | +The **`.Carpet()`** , which is referred specifically as "carpet plot", is a Plotly function used to display interaction between one or more independent variables and one or more dependent variable in a two-dimensional plot. |
| 19 | + |
| 20 | +## Syntax |
| 21 | + |
| 22 | +```pseudo |
| 23 | +plotly.graph_objects.Carpet(a=None,b=None,x=None, y=None, ...) |
| 24 | +
|
| 25 | +``` |
| 26 | + |
| 27 | +- `a`: First parameter values as an array |
| 28 | +- `b`: Second parameter values as an array. |
| 29 | +- `x`: (optional) It is a two dimensional x-coordinates at each carpet point and when omitted, the plot is a cheater plot and x-axis is hidden by default |
| 30 | +- `y` : It is a two dimensional y-coordinates at each carpet point. |
| 31 | + |
| 32 | +- The ellipses is an indication of optional paratemeters that can be added. |
| 33 | + |
| 34 | +## Example |
| 35 | + |
| 36 | +```py |
| 37 | +from plotly import graph_objects as go |
| 38 | + |
| 39 | + |
| 40 | +fig = go.Figure(go.Carpet( |
| 41 | + a = [4, 4, 4, 6.5, 6.5, 6.5, 5, 5, 5, 8, 8, 8], |
| 42 | + b = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], |
| 43 | + y = [2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10], |
| 44 | +)) |
| 45 | + |
| 46 | +fig.show() |
| 47 | +``` |
| 48 | + |
| 49 | +The above code generates the following output: |
| 50 | + |
| 51 | + |
0 commit comments